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.

136 lines
3.8 KiB

  1. import java.awt.JobAttributes;
  2. import java.awt.event.ActionEvent;
  3. import java.awt.event.ActionListener;
  4. import javax.swing.JOptionPane;
  5. import javax.swing.*;
  6. public class Tage_D {
  7. JFrame fr = null;
  8. JPanel Panele = null;
  9. JButton button1 = null;
  10. JLabel label1 = null;
  11. JLabel label2 = null;
  12. JLabel label3 = null;
  13. JLabel label4 = null;
  14. JLabel label5 = null;
  15. JLabel label6 = null;
  16. JLabel label7 = null;
  17. JLabel label8 = null;
  18. JLabel label9 = null;
  19. JLabel labe20 = null;
  20. JTextField j1 = null;
  21. JTextField j2 = null;
  22. JTextField j3 = null;
  23. JTextField j4 = null;
  24. JMenuItem menuItem1 = null;
  25. JMenuItem menuItem2 = null;
  26. JOptionPane opane = null;
  27. JMenuBar bar =null;
  28. JMenu mF= null;
  29. JMenu mH = null;
  30. int button1warsovielmalgedrückt = 0;
  31. public Tage_D() {
  32. this.fr = new JFrame("GUI");
  33. this.fr.setSize(300, 900);
  34. this.Panele = new JPanel();
  35. this.fr.setContentPane(this.Panele);
  36. this.bar = new JMenuBar();
  37. this.fr.setJMenuBar(bar);
  38. this.mF = new JMenu("File");
  39. this.mH = new JMenu("Help");
  40. this.bar.add(mF);
  41. this.bar.add(mH);
  42. this.menuItem1 = new JMenuItem("Exit"); this.mF.add(menuItem1);
  43. this.menuItem2 = new JMenuItem("Info"); this.mH.add(menuItem2);
  44. this.label4= new JLabel("Ein Tool der CI!."); this.Panele.add(label4);
  45. this.label5= new JLabel("Wollen Sie erfahren, Wie viel Zeit bleibt dir in deinem Leben noch?");
  46. this.Panele.add(label5);
  47. this.label1 = new JLabel("Wie ist Ihr Name?"); this.Panele.add(label1);
  48. this.j1 = new JTextField("", 20);
  49. this.Panele.add(j1);
  50. this.j1.setSize(160,20);;
  51. this.label2 = new JLabel("Wie alt sind Sie?");
  52. this.Panele.add(label2);
  53. this.j2 = new JTextField("", 20);
  54. this.Panele.add(j2);
  55. this.j2.setSize(160,20);
  56. this.label3 = new JLabel("Was machen Sie beruflich?");
  57. this.Panele.add(label3);
  58. this.j3 = new JTextField("", 20);
  59. this.Panele.add(j3);
  60. this.button1 = new JButton("Erfahren");
  61. this.Panele.add(button1);
  62. this.j4 = new JTextField("Sie sterben in ___ Jahren!");
  63. this.Panele.add(j4);
  64. this.label6 = new JLabel("Die Wahrheit ist schwer zu ertragen.");
  65. this.Panele.add(label6);
  66. this.label7 = new JLabel("ich hab eine Lösung für dich!");
  67. this.Panele.add(label7);
  68. ButtonGroup buttonGroup = new ButtonGroup();
  69. JRadioButton hzeit = new JRadioButton("Hochzeit");
  70. hzeit.setBounds(100, 170, 100, 20);
  71. buttonGroup.add(hzeit);
  72. this.Panele.add(hzeit);
  73. JRadioButton gtag = new JRadioButton("Geburtstag");
  74. gtag.setBounds(250, 170, 100, 20);
  75. buttonGroup.add(gtag);
  76. this.Panele.add(gtag);
  77. JLabel auswahl = new JLabel("Ihre Auswahl:");
  78. auswahl.setBounds(10, 200, 100, 20);
  79. this.Panele.add(auswahl);
  80. final JTextField text1 = new JTextField();
  81. text1.setBounds(100, 200, 300, 20);
  82. this.Panele.add(text1);
  83. hzeit.addActionListener(new ActionListener() {
  84. public void actionPerformed(ActionEvent ie) {
  85. text1.setText("MALE");
  86. }
  87. });
  88. gtag.addActionListener(new ActionListener() {
  89. public void actionPerformed(ActionEvent ie) {
  90. text1.setText("FEMALE");
  91. }
  92. });
  93. this.fr.setVisible(true);
  94. }
  95. // Action Listener
  96. private class ActionListener1 implements ActionListener {
  97. @Override
  98. public void actionPerformed(ActionEvent e) {
  99. System.exit(0);
  100. }
  101. }
  102. public static void main(String[] args) {
  103. Tage_D gb = new Tage_D();
  104. }
  105. }