• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

check box

 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the JCheckBox API to see if you find any method to select/deselect the box.
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using awt
 
Campbell Ritchie
Sheriff
Pie
Posts: 49827
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49827
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vijayakumar durai wrote:i am using awt
Why?

And Maneesh has beaten me to it
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why?

can you tell what is difference between swing and awt?
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry ya i did n't see the awt method
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Brian Cole
Author
Ranch Hand
Posts: 908
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am creating check box

 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you even look at the CheckboxGroup API?
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i saw the api but i am not able to get
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai maneesh

i understood this 5 methods but my requirment is different
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


how to get the selected object

 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks maneesh i gor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic