Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

getting the selected JCheckBox

Posted on 2003-03-23
5
Medium Priority
?
210 Views
Last Modified: 2010-03-31
Hello,

 i have a set of JLabels and JCheckBoxes and a JButton in a frame.
 when i select the JCheckBoxes and click on the JButton, the selected JCheckBox objects have to be stored in an array.

With JRadioButton, ButtonGroup can be used which gets the selected radiobutton, but with JCheckBox i don't know how to go about this,

help me with this,

regards

   
0
Comment
Question by:arpuda
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
Mayank S earned 120 total points
ID: 8193295
You can scan all your JCheckBoxes in a loop, and use the isSelected () method to check if the current JCheckBox is selected or not (JCheckBox extends JToggleButton, which defines this method. It'll return true if it is selected or checked). If it is, then you can keep adding it to another array of JCheckBoxes.

Mayank.
0
 

Expert Comment

by:CleanupPing
ID: 9058525
arpuda:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9731881
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept mayankeagle's comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 9738215
Kindly proceed with that recommendation.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month11 days, 8 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question