Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JButton startBtn = new JButton("Start");
- JButton answerBtn = new JButton("Answer");
- JButton nextBtn = new JButton("Next");
- TextArea questionTA = new TextArea("Welcome to the challenge Mode", 4,30, TextArea.SCROLLBARS_VERTICAL_ONLY);
- TextField answerTF = new TextField(10);
- TextField responseTF = new TextField(10);
- TextField rightTF =new TextField("0", 2);
- TextField wrongTF = new TextField("0", 2);
- TextField scoreTF = new TextField(3);
- int numRight = 0;
- int numWrong = 0;
- int questionNumber = 0;
- JLabel scoreLbl= new JLabel("Score: ");
- JLabel pointsLbl = new JLabel("Points: ");
- JLabel rightLbl = new JLabel("Correct: ");
- JLabel wrongLbl = new JLabel("Wrong: ");
- JFrame w = new JFrame();
- JPanel p = new JPanel();
- w.setSize(300,350);
- w.setTitle("Challenge Mode");
- w.setLocationRelativeTo(null);
- w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- w.setVisible(true);
- p.setLayout(new FlowLayout());
- p.add(startBtn);
- startBtn.addActionListener(this);
- //p.add(Box.createHorizontalStrut(80));
- //next line
- p.add(questionTA);
- questionTA.setEditable(false);
- //p.add(Box.createHorizontalStrut(80));
- //next line
- p.add(answerTF);
- //p.add(Box.createHorizontalStrut(90));
- //next line
- p.add(answerBtn);
- answerBtn.addActionListener(this);
- p.add(Box.createHorizontalStrut(60));
- p.add(responseTF);
- p.add(nextBtn);
- nextBtn.addActionListener(this);
- p.add(Box.createHorizontalStrut(70));
- //next line
- p.add(pointsLbl);
- p.add(Box.createHorizontalStrut(20));
- p.add(scoreLbl);
- p.add(scoreTF);
- p.add(Box.createHorizontalStrut(90));
- //next line
- p.add(rightLbl);
- p.add(rightTF);
- p.add(wrongLbl);
- p.add(wrongTF);
- w.add(p);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement