?
Solved

getting the selected JCheckBox

Posted on 2003-03-23
5
Medium Priority
?
209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

801 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