I am writing a simple application in java. When creating the menu, the question arose:
For each menu item you need to create an action handler. I read an example from Horstmann. And the question arose - for each action to write a separate class-successor from AbstractAction or you can do something like this:
fileMenu.add(new AbstractAction("Exit") { public void actionPerformed(ActionEvent event) { System.exit(0); } });
How correct?