Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / June 2004

Tip: Looking for answers? Try searching our database.

Get check state of JCheckBox

Thread view: 
Allan Bruce - 20 Jun 2004 10:39 GMT
How can one obtain the state of a JCheckbox?  I want to know if it is
checked or unchecked, not when it is clicked.
Thanks
Allan
Lasse Reichstein Nielsen - 20 Jun 2004 11:12 GMT
> How can one obtain the state of a JCheckbox?  I want to know if it is
> checked or unchecked, not when it is clicked.

<URL: http://java.sun.com/j2se/1.4.2/docs/api/ >

Follow the link "How to Use Buttons, Check Boxes, and Radio Buttons":

Below the heading "Implementing the Button's Functionality" you find
a reference to "isSelected":
<URL: http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/AbstractButton.html#isSelected() >

Good luck
/L
Signature

Lasse Reichstein Nielsen  -  lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
 'Faith without judgement merely degrades the spirit divine.'

Kova - 20 Jun 2004 11:19 GMT
> How can one obtain the state of a JCheckbox?  I want to know if it is
> checked or unchecked, not when it is clicked.

Well when it's clicked just register it into some variable like boolean.
example, set it to non-checked at start:
...if clicked code...
   ...change(cb_clicked); where cb_cliked is boolean

since boolean is ordered type with 2 values I assume you can somehow switch
between true and false with some method that increases or decreases a value.
I don't exactly know what it is in Java.

--
Kova
Roedy Green - 20 Jun 2004 12:54 GMT
>How can one obtain the state of a JCheckbox?  I want to know if it is
>checked or unchecked, not when it is clicked.

see http://mindprod.com/jgloss/jcheckbox.html

Signature

Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.