How to add ActionListener to JMenuItem?<>
This question already has an answer here:
- Java JMenuItem ActionListener 2 answers
One way that you can add an ActionListener to your container is :
public class JMenuClass extends JFrame implements ActionListener
Then, for each JMenuItem that you need a listener, you would do
At the bottom of your class, you would need to add your actionPerformed methods, or however you want to implement it.