Results 1 to 5 of 5
- 11-03-2009, 11:30 PM #1
Show/Hide Label with JToggleButton
I am working on a Guitar chord programe in NetBeans 6.7.1 IDE
I want to use JToggleButton to show and hide a "Mute" label.
What i actually want is:
If the JToggleButton is clicked (down), it shows Mute & if clicked (up) again, it hide the Mute label.
Plz how can i achieve that. I tried using ActionListener() but i couldn't do a dime.
lotta tnxLife is not perfect, but the way you live it can make it perfectly wongerful :cool:
Cross-post from here: How can I display on Button click?
Other thread closed.
OP: please watch the cross-posts. Thanks.
Also, for a toggle button, consider using an ItemListener and checking if the ItemEvent's state (via the getStateChange() method) == ItemEvent.SELECTED or ItemEvent.DESELECTED. The Sun button tutorial and the APIs will show you the way.
If you're still stuck, then show us your code.
- 11-04-2009, 01:20 AM #4
Tnx a zillions
Thanks a lot Fubarable.
Its worked fine...
Actually, I wasn't serious about d ItemListener when i saw it before, but now i must thank for your help.
Last edited by ntagrafix; 11-04-2009 at 01:21 AM. Reason: grammer n spelling mistakeLife is not perfect, but the way you live it can make it perfectly wongerful :cool:
Glad your code now works. If you haven't familiarized yourself with the Sun Swing tutorials, you owe it to yourself to do so. They're probably the best Swing resource around.
- By jmchaffie in forum New To JavaReplies: 3Last Post: 03-10-2011, 09:41 AM
- By lottalava in forum SWT / JFaceReplies: 11Last Post: 10-18-2010, 09:52 AM
- By spacetoha in forum SWT / JFaceReplies: 1Last Post: 03-24-2009, 12:20 PM
- By Java Tip in forum javax.swingReplies: 0Last Post: 06-26-2008, 07:38 PM
- By fahimaamir in forum NetBeansReplies: 1Last Post: 01-26-2008, 06:20 AM