Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

checkboxes?

 
Drake Silver
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have to use a Listener:

chantal
 
Drake Silver
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic