Sunday, January 2, 2011

JButtonMenuItem

JButtonMenuItem is a swing component to add buttons to the JMenuItem, like the edit MenuItem in Google Chrome. This is an easy to use control and can be added to the NetBeans palette. This control fires an buttonClicked event, if the button on the JButtonMenuItem is fired. The getActionCommand method of the event returns the text of the button pressed.

To handle the event you need to subscribe to JButtonMenuItemListener.

Screenshots: