I am coding a GUI quiz and I want it so that when I press "Start" It opens a new window which will be the start of the quiz <--- (Accomplished). I also want the other page I clicked "start" on to go away so there's only 1 window open when doing the quiz. I figured if I could add 2 commands to a JButton and activate both of them with 1 click of the button it would work. Any help?
JButton btnStart = new JButton("Start");
btnStart.setFont(newFont("HP Simplified Light", Font.PLAIN, 22));
btnStart.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Frame2 nw = new Frame2();
nw.NewScreen();