Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How can I make JCheckBox appear armed?  RSS feed

 
John Smith
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
Anyone know how I can programmatically cause a JCheckBox to appear armed, i.e., make it have that gray look when you click down but have yet to release the mouse button? I have a check box as part of a JTree's cell renderer/editor, and whenever I click it (on mouse down), the checkbox changes it's state without ever appearing armed (grayed). Since the checkbox is not actually getting clicked (the renderer is), I don't see that nice 3-state thing happening.
Thanks,
Randy
[ September 05, 2002: Message edited by: Randy Gordon ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of calling setSelected(), you could call doClick(), there is also doClick( int ) that you can specify the time the mouse is held down.
 
John Smith
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahh, thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!