package quiz.application; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Rules extends JFrame implements ActionListener{ String name; JButton start, back; Rules(String name) { this.name = name; getContentPane().setBackground(Color.WHITE); setLayout(null); JLabel heading = new JLabel("Welcome " + name + " to Quiz Up"); heading.setBounds(50, 20, 700, 30); heading.setFont(new Font("Viner Hand ITC", Font.BOLD, 28)); heading.setForeground(new Color(30, 144, 254)); add(heading); JLabel rules = new JLabel(); rules.setBounds(20, 90, 700, 350); rules.setFont(new Font("Tahoma", Font.PLAIN, 16)); rules.setText( ""+ "1. Time Limit: Each question has a 15-second time constraint." + "

" + "2. Correct Answers: Every question has one correct answer." + "

" + "3. 50-50 Lifeline: Players can use this lifeline once to eliminate two incorrect answer options." + "

" + "4. Time Management: Players should answer within the 15-second time limit." + "

" + "5. Scoring: Points awarded for correct answers." + "

" + "6. Incorrect Answers: No penalties for wrong answers." + "

" + "7. Lifeline Usage: Tap the 50-50 lifeline button during any question." + "

" + "8. Fair Play: Follow the rules for fair and enjoyable gameplay." + "

" + "" ); add(rules); back = new JButton("Back"); back.setBounds(250, 500, 100, 30); back.setBackground(new Color(30, 144, 254)); back.setForeground(Color.WHITE); back.addActionListener(this); add(back); start = new JButton("Start"); start.setBounds(400, 500, 100, 30); start.setBackground(new Color(30, 144, 254)); start.setForeground(Color.WHITE); start.addActionListener(this); add(start); setSize(800, 650); setLocation(350, 100); setVisible(true); } public void actionPerformed(ActionEvent ae) { if (ae.getSource() == start) { setVisible(false); new Quiz(name); } else { setVisible(false); new Login(); } } public static void main(String[] args) { new Rules("User"); } }