I want to close my homeScreen
Frame upon opening another Frame
public class MainClass {
public static void main(String[] args) {
JFrame homeScreen = new JFrame("HomeScreen");
homeScreen.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
EsPanel2 panelloPrimo = new EsPanel2();
homeScreen.add(panelloPrimo);
homeScreen.setBounds(0, 0, 690, 470);
homeScreen.setLocationRelativeTo(null);
homeScreen.setVisible(true);
}
}
The EsPanel2 is a class that extends JPanel
and has a button that, upon clicking it, opens up an entirely new Frame by the ActionListener
of the button.