• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unselect all buttons in a JToggleButton ButtonGroup

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Everyone. i have a set of JToggleButtons in a ButtonGroup and I want to change the behaviour of the ButtonGroup to unselect all buttons in the group when an already selected toggle button is clicked again. I know that this is not behaviour that ButtonGroup supports, however in the javadoc for ButtonGroup, it suggest to add an invisible button to the group and programmatically select that button when you want to unselect all button. That is not a problem. My problem is that I cannot figure out a way to detect if a button is already selected. If I use an action event, then no matter what the previous state was, isSelected() returns true. I am lost and tired. Any ideas? thanks.
 
Chrissy Simpson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is amazing what a fresh day can do. I am now just keeping track of the last two buttons pressed so I can determine if all the buttons should be unselected. It would still be nice if anyone knows a way I can do this without tracking the previous action but it is not a big deal.
 
He's giving us the slip! Quick! Grab this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic