Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Three State Checkbox in a JTree - Help!

 
Sumanth Tarigopula
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am trying to implement a JTree in a JTable where every element in the tree is a checkbox. Each parent node in the tree is a three state checkbox. Has anyone implemented such an interface?
Any help is greatly appreciated.
Thanks for your help
Best regards,
Sumanth
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where exactly is your problem? what code do you have so far/what solutions?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"starigopula" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it here.

Thanks! and welcome to the JavaRanch!
 
Alex Qiu
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you mean is the tree leaves are the checkbox , others are 3 state radio button ?
you need a custom tree renderer , checking whether the node is the leaf , then return the checkbox or the radio button component in getTreeCellRendererComponent(...)
That is the key step .
 
BWA HA HA HA HA HA HA! Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!