Write your own TreeCellRenderer
(http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/tree/TreeCellRenderer.html)
and install it on your JTree (tree.setCellRenderer(myRenderer)).
Bart
> Hi,
>
[quoted text clipped - 13 lines]
> Any help appreciated,
> norki
You can write your own DefaultMutableTreeNode:
public class MyDefaultMutableTreeNode extends DefaultMutableTreeNode {
public String displayThis;
public int someKey;
//constructor
public GuiConsoleNode () {
}//end constructor
public GuiConsoleNode (String displayThis, int someKey) {
super(displayThis);
this.someKey = someKey;
}//end constructor
mera - 21 Dec 2005 08:27 GMT
> > Hi,
> >
[quoted text clipped - 29 lines]
> this.someKey = someKey;
> }//end constructor
Made a mistake in the constructor name. This is the correct version:
public class MyDefaultMutableTreeNode extends DefaultMutableTreeNode {
public String displayThis;
public int someKey;
//constructor
public MyDefaultMutableTreeNode() {
}//end constructor
public MyDefaultMutableTreeNode(String displayThis, int someKey) {
super(displayThis);
this.someKey = someKey;
}//end constructor
}