This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JTable with RadioButton Headers

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've seen examples of JTables with push button header examples. They work well enough but I could really use a RadioButton header.

Has anyone ever don't anything like that?

I'm including some code that I use for a push button header. I've tried to adapt a RadioButton header from this code but I have had much luck.




 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got radio buttons to show up in your table headers by having it extend JRadioButton instead of JButton:
You will need change the listener to work better with radio buttons.
 
jefff willis
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim,

Thanks for the help.

My problem with the RadioButton example is that I can't seem to get them to "group."

When I press Column 1 for example, I want the other columns to be un-selected.

I'm in the process of implementing that in my mouse listener, but I was kind of hoping that the SWING components would do this for me.
 
reply
    Bookmark Topic Watch Topic
  • New Topic