For Programmers: Free Programming Magazines  


Home > Archive > Java Help > April 2004 > Jcheckbox.IsSelected()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Jcheckbox.IsSelected()
robguay

2004-04-29, 2:24 pm

String myValue;

boolean killuniverse = myCheckBox.isSelected();

if (killuniverse == true);
{
myValue = "Box Was Checked";
}


This seems to be true all the time.

Checked or Not Checked.

I do not understand.
Andrew Thompson

2004-04-30, 1:22 pm

On 29 Apr 2004 10:15:42 -0700, robguay wrote:

> String myValue;

.....

I think you need to give a complete (short!) example..
<http://www.physci.org/codes/sscce.jsp>

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Fahd Shariff

2004-04-30, 1:22 pm

No it is not true all the time!
---------
JCheckBox box = new JCheckBox() ;
box.setSelected(false) ;
System.out.println(box.isSelected()) ;
box.setSelected(true) ;
System.out.println(box.isSelected()) ;
----------

prints out:
false
true

Maybe you should give details of the entire program... (e.g. are u
using a action listener on the checkbox etc etc)

Fahd
http://www.fahdshariff.cjb.net

robguay@yahoo.com (robguay) wrote in message news:<109455be.0404290915.3c880b47@posting.google.com>...
> String myValue;
>
> boolean killuniverse = myCheckBox.isSelected();
>
> if (killuniverse == true);
> {
> myValue = "Box Was Checked";
> }
>
>
> This seems to be true all the time.
>
> Checked or Not Checked.
>
> I do not understand.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com