CI 2019 von Daniel, Eugen und Michael
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
4.0 KiB

  1. import java.awt.*;
  2. import java.awt.event.ActionEvent;
  3. import java.awt.event.ActionListener;
  4. import javax.swing.JOptionPane;
  5. import javax.swing.*;
  6. import java.awt.event.WindowAdapter;
  7. import java.awt.event.WindowEvent;
  8. import java.util.concurrent.ThreadLocalRandom;
  9. public class Tage_D extends JFrame {
  10. Icon icon1,icon2,icon3;
  11. JLabel bild1,bild2,bild3;
  12. JFrame fr = null;
  13. JPanel Panele = null;
  14. JButton button1 = null;
  15. JTextField j1 = null;
  16. JTextField j2 = null;
  17. JTextField j3 = null;
  18. JTextField j4 = null;
  19. JMenuItem menuItem1 = null;
  20. JMenuItem menuItem2 = null;
  21. JMenuBar bar =null;
  22. JMenu mF= null;
  23. JMenu mH = null;
  24. JMenu mI = null;
  25. public Tage_D() {
  26. fr = new JFrame("Coutinius Integration SS 2019");
  27. fr.setSize(600,800);
  28. fr.setFont(new Font("Helvetica", Font.PLAIN, 12));
  29. fr.setLayout(new FlowLayout());
  30. Panele = new JPanel();
  31. fr.setContentPane(Panele);
  32. bar = new JMenuBar();
  33. fr.setJMenuBar(bar);
  34. mF = new JMenu("File");
  35. mH = new JMenu("Help");
  36. mI = new JMenu("Info");
  37. bar.add(mF);
  38. bar.add(mH);
  39. bar.add(mI);
  40. menuItem1 = new JMenuItem("Exit"); mF.add(menuItem1);
  41. menuItem2 = new JMenuItem("Über"); mI.add(menuItem2);
  42. menuItem2.addActionListener(new ActionListener() {
  43. public void actionPerformed(ActionEvent ie) {
  44. try {
  45. JOptionPane.showMessageDialog(fr, "Tools entwickelt für CI 2019 Copyright by DEM Consulting");
  46. }catch (Exception ex) {
  47. JOptionPane.showMessageDialog(null, "Fehler");
  48. }
  49. }
  50. });
  51. this.fr.addWindowListener(new WindowAdapter() {
  52. public void windowClosing(WindowEvent e) {
  53. System.exit(-1);
  54. }
  55. });
  56. fr.setContentPane(Panele);
  57. /*
  58. icon1 = new ImageIcon(getClass().getResource("bild1.jpg")); bild1 = new JLabel(icon1); fr.add(icon1);
  59. icon2 = new ImageIcon(getClass().getResource("bild2.jpg")); bild2 = new JLabel(icon2); fr.add(icon2);
  60. icon3 = new ImageIcon(getClass().getResource("bild3.gif")); bild3 = new JLabel(icon3); fr.add(icon3);
  61. */
  62. j1 = new JTextField("Tools von Daniel Hauch"); j1.setEditable(false); j1.setSize(450,30); ; Panele.add(j1);
  63. j2 = new JTextField("Wie ist Ihr Name?"); j2.setEditable(false); Panele.add(j2); j2.setSize(450,30); Panele.add(j2);
  64. j3 = new JTextField(""); j3.setEditable(true); Panele.add(j2); j3.setSize(450,30); Panele.add(j3);
  65. button1 = new JButton("Erfahren"); Panele.add(button1);
  66. j4 = new JTextField("Sie sterben in ___ Jahren!"); Panele.add(j4);
  67. ButtonGroup buttonGroup = new ButtonGroup();
  68. JButton szeit= new JButton("Sterbezeitpunkt");
  69. szeit.setBounds(100, 170, 100, 20);
  70. buttonGroup.add(szeit); Panele.add(szeit);
  71. JButton gtag = new JButton("zufällige Alter ausrechnen");
  72. gtag.setBounds(250, 170, 100, 20);
  73. buttonGroup.add(gtag); Panele.add(gtag);
  74. JLabel auswahl = new JLabel("Ihre Auswahl:");
  75. auswahl.setBounds(10, 200, 100, 20);
  76. Panele.add(auswahl);
  77. final JTextField text1 = new JTextField("");
  78. text1.setBounds(100, 200, 300, 20);
  79. Panele.add(text1);
  80. szeit.addActionListener(new ActionListener() {
  81. public void actionPerformed(ActionEvent ie) {
  82. text1.setText("MALE");
  83. }
  84. });
  85. gtag.addActionListener(new ActionListener() {
  86. public void actionPerformed(ActionEvent ie) {
  87. text1.setText("FEMALE");
  88. }
  89. });
  90. gtag.addActionListener(new ActionListener() {
  91. public void actionPerformed(ActionEvent ie) {
  92. text1.setText("FEMALE");
  93. }
  94. });
  95. fr.setVisible(true);
  96. fr.setAlwaysOnTop(true);
  97. fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  98. }
  99. }