How to change the fontcolor of a DefaultMutableTreeNode on click of it?

I am having a JTree which is dynamically generated ,

I want to set the foreground color of a node when i click it and the foreground color should be maintained permanently even if i click the next node, The idea is this the color of all the clicked nodes should be the same.

And If I click the next node the color should change to default color?

Please help me

[385 byte] By [SPBalaa] at [2007-10-3 4:56:34]
# 1
Hi,Read the javadoc about JTree, and follow the Swing tutorial on JTree. It explains how to write a custom renderer.Kaj
kajbja at 2007-7-14 23:01:48 > top of Java-index,Java Essentials,Java Programming...
# 2
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.htmlOh, Btw. You should post Swing related questions in the Swing forum.Kaj
kajbja at 2007-7-14 23:01:48 > top of Java-index,Java Essentials,Java Programming...