How can we change the default tree (folder) Image in JTree..........

Hi,

This is rohini Kumar Chowdary........................................................................

The standard tree is showing while executing a class having JTree.How

can we change the default way of appearance of tree. Can we use our

custom Icons instead of folder icon. Please help me for this.........................

[362 byte] By [rohin.podilea] at [2007-10-3 2:43:55]
# 1
Read the JTree API and click on the "How to Use Trees" line for the tree tutorial which includes a section on how to customize the icons used by the tree.
camickra at 2007-7-14 20:32:19 > top of Java-index,Desktop,Core GUI APIs...
# 2

As camickr said, it can be found in the Java Tutorial.

//...

DefaultTreeCellRenderer rend = new DefaultTreeCellRenderer();

rend.setLeafIcon(new ImageIcon("leaf.gif"));

rend.setOpenIcon(new ImageIcon("open.gif"));

rend.setClosedIcon(new ImageIcon("closed.gif"));

myJTree.setCellRenderer(rend);

davedesa at 2007-7-14 20:32:19 > top of Java-index,Desktop,Core GUI APIs...