NetBeans : How to connect two components , so that they perform the same action? -


i have created jmenuitem , jbutton in jform. there easy way connect them perform same action, using netbeans ide? thank you.

use javax.swing.action implement logic (e.g. extending javax.swing.abstractaction) , assign action menu item and button. both have constructor takes action parameter.

enabling/disable action enable/disable button , menu item.

see swing tutorial's chapter using actions more details


Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -