diff --git a/.idea/misc.xml b/.idea/misc.xml index 0548357..e0844bc 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 43a527e..8aaadf1 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,12 @@ + + + - + + - - - pa. - contantPane - this. - - - this. - this.panel - Panele - - @@ -65,14 +86,18 @@ - @@ -107,9 +132,8 @@ - + - - - - - - + - - + + - + - - + + - + - - + + @@ -311,6 +314,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -347,14 +383,14 @@ - + - - + + - + @@ -362,36 +398,32 @@ - + + - - + + + + - - + + - - - - + - + - - + + - - - - - + diff --git a/out/production/Alpha/Main.class b/out/production/Alpha/Main.class new file mode 100644 index 0000000..9c6cce4 Binary files /dev/null and b/out/production/Alpha/Main.class differ diff --git a/out/production/Alpha/Quiz_E.class b/out/production/Alpha/Quiz_E.class deleted file mode 100644 index 0067f17..0000000 Binary files a/out/production/Alpha/Quiz_E.class and /dev/null differ diff --git a/src/Quiz.java b/src/Quiz.java new file mode 100644 index 0000000..093ad51 --- /dev/null +++ b/src/Quiz.java @@ -0,0 +1,140 @@ +import javax.swing.*; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.util.Random; +import javax.swing.JOptionPane; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +public class Quiz extends JFrame { + + + + + + JFrame fr = null; + JPanel contentPane = null; + JButton button1 = null; + + JTextField j1 = null; + JLabel label1 = null; + JLabel label2 = null; + JLabel label3 = null; + JLabel frage1 = null; + JLabel frage1antworten = null; + + JMenuItem menuItem1 = null; + JMenuItem menuItem2 = null; + + JMenuBar bar =null; + JMenu mF= null; + JMenu mH = null; + + int button1warsovielmalgedrückt = 0; + + public Quiz() { + + this.fr = new JFrame("GUI"); + this.fr.setSize(430, 630); + + + this.contentPane = new JPanel(); + this.fr.setContentPane(this.contentPane); + + this.bar = new JMenuBar(); + this.fr.setJMenuBar(bar); + this.mF = new JMenu("File"); + this.mH = new JMenu("Help"); + this.bar.add(mF); + this.bar.add(mH); + + this.menuItem1 = new JMenuItem("Exit"); + this.mF.add(menuItem1); + + this.menuItem1.addActionListener(new CloseListener()); + + this.menuItem2 = new JMenuItem("Info"); + this.mH.add(menuItem2); + + this.menuItem2.addActionListener(new CloseListener3()); + + this.label1 = new JLabel("Herzlich willkommen zu unserem Quiz!"); + this.contentPane.add(label1); + + this.label2 = new JLabel("Beantworten Sie uns 5 kurze Fragen und gewinnen Sie 10000 Euro!"); + this.contentPane.add(label2); + + this.frage1 = new JLabel("Frage 1 lautet: Was gehört nicht zum Test Driven Developement?"); + this.contentPane.add(frage1); + + this.frage1antworten = new JLabel("A : Refactoring B : Transformation C : Clean Code D : Neuer Test "); + this.contentPane.add(frage1antworten); + + this.label3 = new JLabel("Antwort:"); + this.contentPane.add(label3); + this.j1 = new JTextField("", 20); + this.contentPane.add(j1); + this.j1.setSize(250,30);; + + + + this.button1 = new JButton("Prüfen"); + this.contentPane.add(button1); + this.button1.addActionListener(new CloseListener2()); + + this.fr.setVisible(true); + + } + + public static void main(String[] args) { + Quiz g = new Quiz(); + + } + + private class CloseListener implements ActionListener{ + @Override + public void actionPerformed(ActionEvent e) { + + System.exit(0); + } + } + + public class CloseListener2 implements ActionListener{ + @Override + public void actionPerformed(ActionEvent a) { + button1warsovielmalgedrückt++; + if(j1.getText().startsWith("C") || j1.getText().startsWith("c") ) { + System.out.println("ja"); + j1.setText("Richtig ! Gewinn 1000 Euro"); + + button1warsovielmalgedrückt++; + }else{ + System.out.println("nein"); + j1.setText("Falsch geantwortet! "); + } + + + + } + + } + + public class CloseListener3 implements ActionListener{ + @Override + public void actionPerformed(ActionEvent a) { + System.out.println("Hier sollen Sie Info bekommen"); + } + } + + } + + + + + + + + + + + diff --git a/src/Quiz_E.java b/src/Quiz_E.java deleted file mode 100644 index cfc64db..0000000 --- a/src/Quiz_E.java +++ /dev/null @@ -1,107 +0,0 @@ -import java.awt.JobAttributes; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import javax.swing.JOptionPane; -import javax.swing.*; -public class Quiz_E { - - JFrame fr = null; - JPanel contentPane = null; - JButton button1 = null; - JLabel label1 = null; - JLabel label2 = null; - JLabel label3 = null; - JLabel label4 = null; - JLabel label5 = null; - JLabel label6 = null; - JLabel label7 = null; - JTextField j1 = null; - JTextField j2 = null; - JTextField j3 = null; - JTextField j4 = null; - - JMenuItem menuItem1 = null; - JMenuItem menuItem2 = null; - JOptionPane opane = null; - JMenuBar bar =null; - JMenu mF= null; - JMenu mH = null; - - int button1warsovielmalgedrückt = 0; - - public Quiz_E() { - - this.fr = new JFrame("GUI"); - this.fr.setSize(300, 900); - - - this.contentPane = new JPanel(); - this.fr.setContentPane(this.contentPane); - - this.bar = new JMenuBar(); - this.fr.setJMenuBar(bar); - this.mF = new JMenu("File"); - this.mH = new JMenu("Help"); - this.bar.add(mF); - this.bar.add(mH); - - this.menuItem1 = new JMenuItem("Exit"); - this.mF.add(menuItem1); - - - - this.menuItem2 = new JMenuItem("Info"); - this.mH.add(menuItem2); - - this.label4= new JLabel("Das spiel wird ihr Leben verändern."); - this.contentPane.add(label4); - this.label5= new JLabel("Wollen Sie erfahren, Wie viel Zeit bleibt dir in deinem Leben noch?"); - this.contentPane.add(label5); - this.label1 = new JLabel("Wie ist Ihr Name?"); - this.contentPane.add(label1); - - this.j1 = new JTextField("", 20); - this.contentPane.add(j1); - this.j1.setSize(160,20);; - this.label2 = new JLabel("Wie alt sind Sie?"); - this.contentPane.add(label2); - this.j2 = new JTextField("", 20); - this.contentPane.add(j2); - this.j2.setSize(160,20); - - this.label3 = new JLabel("Was machen Sie beruflich?"); - this.contentPane.add(label3); - this.j3 = new JTextField("", 20); - this.contentPane.add(j3); - - this.button1 = new JButton("Erfahren"); - this.contentPane.add(button1); - - this.j4 = new JTextField("Sie sterben in ___ Jahren!"); - this.contentPane.add(j4); - - this.label6 = new JLabel("Die Wahrheit ist schwer zu ertragen."); - this.contentPane.add(label6); - - this.label7 = new JLabel("ich hab eine Lösung für dich!"); - this.contentPane.add(label7); - - this.fr.setVisible(true); - - - - - - } - - - - - - - public static void main(String[] args) { - Quiz_E q = new Quiz_E(); - - } - -}