Hi,
> You need to enable the renderer component. The renderer sets the enabled
> state of the renderer component (a JLabel) to the enabled state of the
> JTree. JLabel ignores the foreground color and paints itself differently
> when it is disabled. See the getTreeCellRendererComponent() method of
> DefaultTreeCellRenderer for more details.
I do already override getTreeCellRendererComponent() and I use
myLabel.setForeground() to change the color. This works fine as long as the
corresponding tree is setEnabled(true). As soon as I call
JTree.setEnabled(false) the setForeground() looses its effect.
What now?
Regards,
Ren?
John McGrath - 15 Feb 2005 11:51 GMT
> > You need to enable the renderer component.
>
[quoted text clipped - 3 lines]
> JTree.setEnabled(false) the setForeground() looses its effect.
> What now?
Enable the renderer component.
The component that you return from the getTreeCellRendererComponent() is
what paints the cell. If that component is disabled, it will paint the
cell so as to appear disabled, and it ignores the foreground color. You
need to enable the component, so it will not paint the cell so as to
appear disabled.
If this still does not make sense to you, please post the code of your
getTreeCellRendererComponent() method.

Signature
Regards,
John McGrath
Rene Ruppert - 15 Feb 2005 12:21 GMT
Hi,
> Enable the renderer component.
Okay, now I understand your previous post! That's it of course...a simple
myLabel.setEnabled(true) before returning it did the job.
Thanks.
Ren?