Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JCheckBox setSelected method fires ItemEvent  RSS feed

 
Meghana Reddy
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



The handleSendEmailChanged() method will be fired whenever the sendEmail is selected or deselected.

Now when there is an exception , I am trying to set the sendEmail checkbox value to the previous value and not allow it to change.

But when I use the JCheckBox's setSelected() method , its again firing the ItemEvent and this method is invoked again and is an infinite loop.

Any ideas? Its urgent, thanks

Meghana
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some pointers:
Any ideas? Its urgent, thanks

EaseUp


It is recommended that you use AbstractButton#setContentAreaFilled() instead.

Instead of ItemListener add an ActionListener because setSelected() does NOT fire an actionEvent. In case you want to, you can call a doClick() which WILL fire the actionEvent.
 
Meghana Reddy
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That works - thank you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!