The Artima Developer Community
Sponsored Link

Java Answers Forum
help

4 replies on 1 page. Most recent reply: Jun 7, 2003 10:38 AM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
jess

Posts: 2
Nickname: jessy
Registered: Jun, 2003

help Posted: Jun 7, 2003 1:49 AM
Reply to this message Reply
Advertisement
can someone tell me how to checked whether a checkbox is checked or not? when i try to use jc.getState(), it will show an error, cannot define symbok:method getState().


angelina

Posts: 6
Nickname: angelina
Registered: May, 2003

Re: help Posted: Jun 7, 2003 2:41 AM
Reply to this message Reply
Hello Jess,
Theres a method called,isSelected() which will return a boolean value.

For eg:
jCheckBox1 is the name of ur check box, then u can check like this:
If (jCheckBox1.isSelected()) {
System.out.println("Selected");
}

I hope this will help...


> can someone tell me how to checked whether a checkbox is
> checked or not? when i try to use jc.getState(), it will
> show an error, cannot define symbok:method getState().

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: help Posted: Jun 7, 2003 8:34 AM
Reply to this message Reply
Go to http://java.sun.com/ and check out the documentation on line or download a copy to your machine.

The latest j2sdk1.4.1 is at:
http://java.sun.com/j2se/1.4.1/download.html#docs

The index of online APIs is at:
http://java.sun.com/api/index.html

jess

Posts: 2
Nickname: jessy
Registered: Jun, 2003

Re: help Posted: Jun 7, 2003 9:01 AM
Reply to this message Reply
thanks for both of ur help!
and i got one question here, if we created a checkbox, is it a MUST to create an itemlistener? or we can just write the coding inside other functions.
thanks

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: help Posted: Jun 7, 2003 10:38 AM
Reply to this message Reply
The Component class also has various add listener methods. Checkbox extends Component. They may not be appropriate though for listening specifically to whether a checkbox is checked or unchecked.

If you want the checkbox to do something, then the ItemListener is specifically programmed to make that easy to program.

Flat View: This topic has 4 replies on 1 page
Topic: Crystal Report with Java Previous Topic   Next Topic Topic: yahoo games

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use