File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes checkboxes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "checkboxes?" Watch "checkboxes?" New topic
Author

checkboxes?

Drake Silver
Ranch Hand

Joined: Apr 21, 2002
Posts: 80
hi, I've done the usual search, and though it has yielded a wealth of information, I'm still a slow learner.
this is what Is want to do:
I want to allow wordwrap true/false via a checkbox.
I've created the checkbox, and have it initially selected...now I'm trying to connect this to LineWrap on a TextArea.
I've done this in Delphi, but in Java it really is different.
I was thinking that I could do something like this:

But, although this code would work in Delphi,
I don't know how to convert it over to Java...
any help? please.
[ November 26, 2002: Message edited by: Drake Silver ]

"Shh, Zog....here come one Now!"
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
you have to use a Listener:

chantal
Drake Silver
Ranch Hand

Joined: Apr 21, 2002
Posts: 80
Perfect!
Thankyou Chantal.
I already had an action performed listener, but I didn't know how to access the method, selected.
Until I saw that you had .isSelected!
Boom, I was blown away. The asnwer to my problems.

thankyou. It works like a charm.
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
it's less overhead to use the ItemStateListener than the ActionListener. - sorry that I have not mentioned it in the first mail. I didn't think of it by then. the itemstatelistener is only notified if the selection changes, while the actionlistener is notified even if the checkbox is already selected and gets clicked a second time.
chantal
Drake Silver
Ranch Hand

Joined: Apr 21, 2002
Posts: 80
Originally posted by Chantal Ackermann:
it's less overhead to use the ItemStateListener than the ActionListener. - sorry that I have not mentioned it in the first mail. I didn't think of it by then. the itemstatelistener is only notified if the selection changes, while the actionlistener is notified even if the checkbox is already selected and gets clicked a second time.
chantal


oh.
Cool.
Thanks for the tip.
It's always great to get a little tip or two from a more experienced programmer.
I'll make the adjustments.
Thank you again for all of your help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: checkboxes?