-1
I’m trying to do a quiz. So I would like to update the same "screen" or frame - as you like - that is, you have the first question, the user responds and the frame updates with a new question and so on. My idea was to do everything on the same screen, but I accept suggestions, if they recommend I create other frames (which would be easier, but more laborious). It follows the code: String[] questions = new String[3]; questions[0] = "Question 1 ?"; questions1 = "Question 2 ?" questions[2] = "Question 3 ?";
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 600, 471);
    contentPane = new JPanel();
    contentPane.setBackground(new Color(255, 153, 0));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);
    JPanel panel = new JPanel();
    panel.setBounds(0, 167, 616, 265);
    panel.setBackground(new Color(0, 0, 128));
    contentPane.add(panel);
    panel.setLayout(null);
    rdA = new JRadioButton(" A");
    rdA.setBackground(new Color(0, 0, 128));
    rdA.setForeground(Color.WHITE);
    rdA.setFont(new Font("Tahoma", Font.PLAIN, 12));
    rdA.setBounds(24, 53, 48, 23);
    panel.add(rdA);
    rdB = new JRadioButton(" B");
    rdB.setForeground(Color.WHITE);
    rdB.setFont(new Font("Tahoma", Font.PLAIN, 12));
    rdB.setBackground(new Color(0, 0, 128));
    rdB.setBounds(24, 94, 48, 23);
    panel.add(rdB);
    rdC = new JRadioButton(" C");
    rdC.setForeground(Color.WHITE);
    rdC.setFont(new Font("Tahoma", Font.PLAIN, 12));
    rdC.setBackground(new Color(0, 0, 128));
    rdC.setBounds(24, 140, 48, 23);
    panel.add(rdC);
    rdD = new JRadioButton(" D");
    rdD.setForeground(Color.WHITE);
    rdD.setFont(new Font("Tahoma", Font.PLAIN, 12));
    rdD.setBackground(new Color(0, 0, 128));
    rdD.setBounds(24, 186, 48, 23);
    panel.add(rdD);
    alternativas = new ButtonGroup ();
    alternativas.add(rdA);
    alternativas.add(rdB);
    alternativas.add(rdC);
    alternativas.add(rdD);
    JButton btnAvan = new JButton("Avan\u00E7ar");
    btnAvan.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
        }
    });
    btnAvan.setBounds(292, 231, 89, 23);
    panel.add(btnAvan);
    }
}
						