• 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

JTree, CheckBox, Programmatically Checking CheckBox  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All.

Searched high and low for this but couldn't figure it out.....
I am using this http://www.jroller.com/santhosh/date/20050610 code to create a JTree with checkboxes. All is cool, except when I load nodes into the tree I need to programmatically set the check
on the checkbox nodes. Any ideas on how to do this?

--Kirt
 
Marshal
Posts: 64494
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

What about the setSelected(boolean) method? Have you found that?
 
Kirt Cathey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With the code that I referred to in the original posting, there are check boxes in the manager and the renderer.

Which one to setSelected with?
When I expose either one and setSelected, nothing changes on the tree.

Repaint issue?
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you try posting a comment (question) on the blog?
did you try emailing the author of the code?
 
Kirt Cathey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No and No.... the posting was from 2005. After some thorough reading and much trial and error, I learned a bit about cell renderer. But it look's like there is more than one way to make this happen.
Here is the code I ended up with... but didn't use check boxes - opted for status markers instead.


 
Sheriff
Posts: 21745
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags next time. I've added them for you this time.
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!