Refresh JTrees

Hi guys,

I am currently working a project which required me to implement three different hierarchy structure and use combobox to choose between them. I am able to construct three trees and able to display individual correctly. But I have difficulty to refresh the hierachy tree by choose another combobox choice. I would be appreciated if some one can give me a simple examples to show how do I do it.

i.e. I had three combobox color, sport and food. also three corresponding hierachy, at each time only one hierarchy can be displayed by choosing one of the combobox.

Thanks very much

[609 byte] By [SmartEnginea] at [2007-11-27 9:33:05]
# 1
call repaint and/or revalidate
java_2006a at 2007-7-12 22:53:22 > top of Java-index,Desktop,Core GUI APIs...
# 2
Do I repaint the Frame or just to repaint the tree?
SmartEnginea at 2007-7-12 22:53:22 > top of Java-index,Desktop,Core GUI APIs...
# 3
repaint all the frame
java_2006a at 2007-7-12 22:53:22 > top of Java-index,Desktop,Core GUI APIs...
# 4

/* declaration of JTree */

DefaultMutableTreeNode myTreeTopNode = new DefaultMutableTreeNode("Root");

DefaultTreeModel myTreeModel = new DefaultTreeModel(myTreeTopNode);

JTree myTree = new JTree(myTreeModel);

//do your change on tree

/* reload the tree */

myTreeModel.reload();

Bye

Monica

monksa at 2007-7-12 22:53:22 > top of Java-index,Desktop,Core GUI APIs...
# 5
hi, I used some very good Java Beans Package in my project which includes Tree api.In this Tree API it gives you a facility of adding a node using mouse click ,adding a value like wise and many more Tree related functionality.you can visit www.elegantjbeans.com
chrisbonda at 2007-7-12 22:53:22 > top of Java-index,Desktop,Core GUI APIs...