I have created a JMenuItem and a JButton.
How can I have the same result when I use either the JMenuItem or the JButton?
Basically I want them to trigger the same method.
Thank you.

Recommended Answers

The Action mechanism was created for exactly this purpose:
http://docs.oracle.com/javase/tutorial/uiswing/misc/action.html

Jump to Post

All 3 Replies

Is there an easy way to do this connection in netbeans?

Sorry, don't know, I use Eclipse.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.