Take a look at public void setCellRenderer(TreeCellRenderer x) in JTree.
TreeCellRenderer is an interface with the following method:
public Component getTreeCellRendererComponent(
JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
By default the returned component is a JLabel. Therefore, anything you can
do to a label you can to to the renderer. You are not limited to having
this renderer be a JLabel; as the return indicates, it can be any kind of
Component.
Hope this helps, rand
--------------------------------
Rand Clark
Software Design Engineer
Transoft Networks
a Hewlett-Packard company
805.883.4315
[EMAIL PROTECTED]
--------------------------------
-----Original Message-----
From: Brian Steele [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 7:15 AM
To: [EMAIL PROTECTED]
Subject: Can DefaultMutableTreeNode BGColor be changed?
I've created a tree of Strings using DefaultMutableTreeNodes. Now I'm
displaying the tree using JTree.
I can change the background color of the tree using setBackground(), but
this does not affect the leaves of the tree. Anyone know how to change the
leaf background color?
Thanks,
Brian
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing
RE: Can DefaultMutableTreeNode BGColor be changed?
CLARK,RAND (HP-Roseville,ex1) Tue, 13 Feb 2001 09:13:30 -0800
- Can DefaultMutableTreeNode BGColor be change... Brian Steele
- Re: Can DefaultMutableTreeNode BGColor ... Paul Brinkley
- CLARK,RAND (HP-Roseville,ex1)
