aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes check box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "check box" Watch "check box" New topic
Author

check box

vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
i have check box group if check box is checked i have to uncheck the check box can any body tell how to uncheck the checked check box in group?



thanks in advance








Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Check out the JCheckBox API to see if you find any method to select/deselect the box.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
i am using awt
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40034
    
  28
Have you been through the API documentation to see whether there are any methods for setting the box as selected or not?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40034
    
  28
vijayakumar durai wrote:i am using awt
Why?

And Maneesh has beaten me to it
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
why?

can you tell what is difference between swing and awt?
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
sorry ya i did n't see the awt method
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19781
    
  20

vijayakumar durai wrote:why?

can you tell what is difference between swing and awt?

Swing is more powerful, with a richer set of components including tables and trees.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 863
    
    1
vijayakumar durai wrote:can any body tell how to uncheck the checked check box in group?

What part are you having trouble with: determining which box is the checked one, or performing the unchecking?

If the former, one approach is to not bother and just attempt to uncheck them all.



And, dovetailing with with some of the other posters here, if you don't know why you're using AWT over Swing then you should probably just use Swing. (There are situations where AWT is called for, but they are relatively rare and I would think you would be aware of it if you were in one.)


bitguru blog
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
i am doing exam project in this first question will come from database i am creating check box from group. it will have 4 checkbox for options in awt if user select any one checkbox and click next button it will display second question i am displaying question from label i
when icheckedoption for first question it will also checked for second question
i am changing label value using
radioopt1.setLabel

i had given but its not working



vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
i am creating check box

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Checkboxes essentially denote multiple choices. As per your description, a Radio button would be an appropriate choice.

Coming back to your problem, "it doesn't work" does not help us help you. Have you ensured (by debugging perhaps) that the uncheck code is really getting triggered? Always share the details
If you had peeked through the CheckBoxGroup API, you would have noticed setSelectedCheckbox method. Read the API documentation to figure out how to deselect all checkboxes in that group.
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
actually i am adding checbox in checkbox group can any body tell how to get the name of selected check box?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Did you even look at the CheckboxGroup API?
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
i saw the api but i am not able to get
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

I checked. The API lists 5 (yes, only five) methods.
Even the method description is in simple English.
I fail to understand how we can be more helpful.
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
hai maneesh

i understood this 5 methods but my requirment is different
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

How come?
You want the name of the selected checkbox.
The CheckBoxGroup gives you the selected CheckBox.
Once you got the CheckBox you can get the text.
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153


how to get the selected object

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

You mean the variable name.
What you need is reflection

Why do you want to do it that way? The method getSelectedCheckbox() already gives you the instance.
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
thanks maneesh i gor
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: check box