I have 2 classes which extends Jframe. I would like to call the 2nd Jframe when button clicked and return back when close clicked. So on 1st JFrame I wrote this code
public void actionPerformed(ActionEvent e) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Lessons frameLessons = new Lessons();
frameLessons.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
But when I try to close the 2nd Jframe, the 1st also closes