Do I have to work with an ActionListener
or AbstractAction
?
EDITED BASED ON ANSWERS
So, the best way this is the best way to do it?
Action closeaction = new AbstractAction("Afsluiten"){
@Override
public void actionPerformed(ActionEvent ae) {
System.exit(1);
}
};
menuItem = new JMenuItem(closeaction);