Thread View: comp.lang.java.gui
4 messages
4 total messages
Started by George Wilson Mathias
Thu, 13 Jan 2000 00:00
Problem with the ButtonGroup
Author: George Wilson Mathias
Date: Thu, 13 Jan 2000 00:00
Date: Thu, 13 Jan 2000 00:00
17 lines
1369 bytes
1369 bytes
Hello all, I have a buttonGroup, which has 3 buttons associated with it. User selects one of the button in that group and if User selects "Undo" all the buttons must be deselcted. I tried to use button.setSelected(false) to all three buttons, didn't seem to work. Then I said : buttonGroup.setSelected(new DefaultButtonModel(), false); This didn't work either. Can you please tell me how can I de-select all the buttons in a Button programmatically. This is really bugging me for a while now. Thanks a lot in-advance. George Mathias george.mathias@wcom.com
Re: Problem with the ButtonGroup
Author: George Wilson Mathias
Date: Thu, 13 Jan 2000 00:00
Date: Thu, 13 Jan 2000 00:00
29 lines
1675 bytes
1675 bytes
Hello All,, I fixed it with a work around. What I did, I removed all the buttons from the group first and then Deselected one by one and then added them back to the group. It worked great. George Mathias George Wilson Mathias wrote: > Hello all, > > I have a buttonGroup, which has 3 buttons associated with it. User > selects one of the button in that group and if User selects "Undo" all > the buttons must be deselcted. I tried to use button.setSelected(false) > to all three buttons, didn't seem to work. Then I said : > > buttonGroup.setSelected(new DefaultButtonModel(), false); This didn't > work either. > > Can you please tell me how can I de-select all the buttons in a Button > programmatically. This is really bugging me for a while now. > > Thanks a lot in-advance. > > George Mathias > george.mathias@wcom.com
Re: Problem with the ButtonGroup
Author: Michael Raymond
Date: Fri, 14 Jan 2000 00:00
Date: Fri, 14 Jan 2000 00:00
43 lines
2078 bytes
2078 bytes
I haven't coded this problem myself but i thought ButtonGroup.setSelected(null, true); would do the trick. You can set up the group so initially no button is selected but once a user selects a button, as far as im aware, there is no API support for deselecting all the buttons in the group. The above line of code should work though. All the best, Michael. George Wilson Mathias wrote: > Hello All,, > > I fixed it with a work around. > > What I did, I removed all the buttons from the group first and then > Deselected one by one and then added them back to the group. It worked > great. > > George Mathias > > George Wilson Mathias wrote: > > > Hello all, > > > > I have a buttonGroup, which has 3 buttons associated with it. User > > selects one of the button in that group and if User selects "Undo" all > > the buttons must be deselcted. I tried to use button.setSelected(false) > > to all three buttons, didn't seem to work. Then I said : > > > > buttonGroup.setSelected(new DefaultButtonModel(), false); This didn't > > work either. > > > > Can you please tell me how can I de-select all the buttons in a Button > > programmatically. This is really bugging me for a while now. > > > > Thanks a lot in-advance. > > > > George Mathias > > george.mathias@wcom.com
Re: Problem with the ButtonGroup
Author: Eric Rizzo
Date: Fri, 14 Jan 2000 00:00
Date: Fri, 14 Jan 2000 00:00
20 lines
1600 bytes
1600 bytes
George Wilson Mathias wrote:
>
<snip>
> Can you please tell me how can I de-select all the buttons in a Button
> programmatically. This is really bugging me for a while now.
One option is to create a "dummy" button that is not added to the
containing panel but *is* added to the ButtonGroup. Then implement a
unselectAll() method that just selects this "invisible" button, thus
making it appear as if no buttons are selected.
Hope this helps,
Eric
--
Eric Nicholas Rizzo
erizzo@tampabay.rr.com
---------------------------------------------------------------
"Don't make me come down there!"
-God
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads