3

How can we display multiple fields of a object in DefaultTreeCellRenderer. Please let me know if there is any tutorial. I have tried this tutorial but it isn't talked about displaying the object data in many column.

Ashish
  • 14,295
  • 21
  • 82
  • 127
  • JTrees display one column. JTables display more than one column. You can have a popup display the rest of the information for a JTree column. – Gilbert Le Blanc May 06 '13 at 19:34
  • The `DefaultMutableTreeNode` just uses the `toString()` method of the `Object` passed into its contructor, so you could extract the fields there. Alternatively, there are such things as `TreeTable`s, but not in the JDK so you'd have to find one. – kuporific May 06 '13 at 19:53
  • @kuporfic I have tried that method but I am not able to put some space between the two column. – Ashish May 06 '13 at 23:18

2 Answers2

4

After some research I have found the tutorial which I was looking. Here is the link

http://www.hameister.org/JavaSwingTreeTable.html

Grim
  • 1,938
  • 10
  • 56
  • 123
Ashish
  • 14,295
  • 21
  • 82
  • 127
2

You might look at org.netbeans.swing.outline.Outline, mentioned here and here. The stand-alone JAR is in the NetBeans distribution:

NetBeans/platform/modules/org-netbeans-swing-outline.jar

image

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045