This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Integrating menuItem and JButton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Integrating menuItem and JButton" Watch "Integrating menuItem and JButton" New topic
Author

Integrating menuItem and JButton

Kashif Iqbal Khan
Greenhorn

Joined: Dec 22, 2001
Posts: 13

My question is that is there anyway to fire action object when menuItem's state is changed?
The menuItem and toolbar button for that action perform same task so they must represent the same state like both disabled or enabled.
[ January 23, 2004: Message edited by: Kashif Khan ]

Kashif I. Khan
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Hi
I'm not sure I understand your question very well. In the code below the actionPerformed method, and methods in general, do not hold state. The class that the method is in can hold state. And yes, you can certainly arrange for your JCheckBoxMenuItem to fire events.
Maybe you can use this example app to clarify what you want.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Integrating menuItem and JButton
 
Similar Threads
JCheckboxMenuItem won't change selection color
Pairing a CheckboxMenuItem with a JToggleButton
Toolbar
JToolBar icons not seen
AbstractAction with toggle state