It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes JTreeTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTreeTable" Watch "JTreeTable" New topic
Author

JTreeTable

Kurt Peters
Greenhorn

Joined: Apr 22, 2009
Posts: 17
http://java.sun.com/products/jfc/tsc/articles/treetable1/

I'm trying to use a JTreeTable with my own model, I have hand-jammed children and root nodes that are a subclass of DefaultMutableTreeNode.

It seems that number of children is correctly returned for getChildCount, and isLeaf return true of false correctly, but the little "plus sign" icons are not showing up to allow nodes to open/close.

Does anyone have any ideas of what method I might not be overriding to get this to work properly? I've tried the examples on the web site above, and they work. When I change to 'my data' and subclass of defaultmutabletreenode, I get this weird behaviour.

Kurt
Kurt Peters
Greenhorn

Joined: Apr 22, 2009
Posts: 17
I found the solution. I had not defined one of the columns to override getColumnClass to return TreeTableModel.class in the column I wanted the tree to appear.
 
Consider Paul's rocket mass heater.
 
subject: JTreeTable
 
Similar Threads
JTreeTable problem
JTreeTable and custom renderers/editors
JTreeTable Expansion problems
JTreeTable - tree of DefaultMutableTreeNodes
JTreeTable programmatic selection