• Post Reply Bookmark Topic Watch Topic
  • New Topic

re: adding JCheckBoxes to Jtree  RSS feed

 
joew weakers
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the second query within such a short space of time. Can anybody point me in the right direction regarding adding a JCheckBox to each child node in a JTree. My application in volves turning items on and off but there is a hierarchy amongst the items in the application. Thanks in advance for any help...Joe
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to implement a custom TableCellRenderer and TableCellEditor... basically instead of just using a JLabel, you'll need to use a JPanel with a JCheckBox and a JLabel in it.

Check out the section on Editors and Renderers in the Swing tutorial.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!