заголовок темы уже объясняет, в чем моя проблема.Это известная ошибка?Я искал в интернете, но не смог найти решение.
Итак, вы знаете, что делать?
public static void main(String[] args) {
JFrame frame = new JFrame("Menu");
frame.setVisible(true);
frame.setSize(500,500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuBar menubar = new JMenuBar();
frame.setJMenuBar(menubar);
JMenu file = new JMenu("File");
menubar.add(file);
JMenuItem exit = new JMenuItem("Exit");
file.add(exit);
JMenu help = new JMenu("Help");
menubar.add(help);
JMenuItem about = new JMenuItem("About");
help.add(about);
class exitAction implements ActionListener {
public void actionPerformed(ActionEvent e){
System.exit(0);
}
}
exit.addActionListener(new exitAction());
}