This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to select a particular checkbox in a series Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to select a particular checkbox in a series" Watch "How to select a particular checkbox in a series" New topic
Author

How to select a particular checkbox in a series

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 800

Hi everybody, I am having a problem with check boxes. I have 100 check boxes in my JPanel. I have few values in a text file. What I am supposed to do is, read the values from file and check the corresponding check box.

Please tell me how to select particular check boxes. Thank you all in advance.


Love all, trust a few, do wrong to none.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

Have you checked out the JCheckBox API? Look for methods which will help you set its selection state (hint)


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

Joined: Sep 15, 2009
Posts: 800

Hey guys, the problem has been solved. I am using a Map<String,JCheckBox> to store the check boxes.

This is working properly. Hope this approach is correct.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to select a particular checkbox in a series
 
Similar Threads
Need Script
Problems with form validation
JavaScript function on Input type dynamically generated
how to get selected check box values in struts?
doubt