My issue is that in my code, I create a new JFrame object called frame. In another method I want to close that frame. Any suggestions?
// Non-relevant code private static class oddbutton implements ActionListener{ public void actionPerformed(ActionEvent e) { } } //More Non-relevant code public void run(){ NewGame.setoddnumber(); NewGame.setevennumber(); NewGame.separate(); JFrame frame = new JFrame("Button Game!"); addComponentsToPane(frame.getContentPane()); Insets insets = frame.getInsets(); frame.setSize(200, 300); frame.setVisible(true); }
As of now, I have nothing in my oddbutton class. I don't know how to close the frame.