private class Lis implements ActionListener{
public void actionPerformed(ActionEvent e){
Object obj=e.getSource();
if(obj==startMenuItem){
System.out.println("重新开始");
}
else if(obj==exitMenuItem){
System.out.println("退出");
}
else if(obj==backMenuItem){
System.out.println("悔棋");
}
}
}
Lis lis=new Lis();
menubar=new JMenuBar();
sysmenu=new JMenu("菜单");
startMenuItem=new JMenuItem("重新开始");
exitMenuItem=new JMenuItem("退出");
backMenuItem=new JMenuItem("悔棋");
startMenuItem.addActionListener(lis);
exitMenuItem.addActionListener(lis);
backMenuItem.addActionListener(lis);