So I just started with JFrame and JMenuBar, and I tried to do this:
main file(the window class is my JFrame class):
public class main {
public static void main(String avg[]) {
    window win = new window();
    win.setVisible(true);
}
}
my menu class(the Startwin class is another JFrame class):
public menu() {
JMenu main = new JMenu("File");                        
JMenuItem start = new JMenuItem("ReStart",KeyEvent.VK_R);      
    start.setActionCommand("press OK to continue");
    start.addActionListener(this);
    JMenuItem save = new JMenuItem("Save",KeyEvent.VK_S);
    save.setActionCommand("saved");
    save.addActionListener(this); 
.
.
.
  main.add(start);                                           
  main.add(save);
.
.
.
.
  @Override
public void actionPerformed(ActionEvent e) {
window w = new window();
Startwin a = new Startwin();
if (e.getActionCommand()=="press OK to continue") {
    a.setVisible(true);
    w.setVisible(false);
}
}
}
So when I ran it, the first JFrame window didn't close. Any suggestions?
oh and by the way, sorry if the staff I wrote is unreadable...
 
     
     
    