Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Painting a tree node yellow

0 views
Skip to first unread message

JMC

unread,
Mar 16, 2004, 1:44:20 PM3/16/04
to
I have a tree displayed in a Frame, and on top of that a modal dialog
into which you can enter some text, and then repeatedly hit a "find"
button that will find the text again and again within the tree node
user objects (tho' only those that are Strings). The nodes are walked
through using a breadthFirstEnumeration() Enumerator, and everything
is super, except......

When a node is found, I want the user's attention drawn to it, but for
certain reasons I cannot do "the obvious", which is set the found node
to be selected. Instead, I just want to set as yellow the background
colour for the component (most probably a JLabel) that contains the
user object String that matches the find text.

Can this be done WITHOUT faffing about with a TreeCellRenderer? I
don't want to interfere with any existing TreeCellRenderer that the
tree may already have - besides, there must be an easier way anyway!
Can you navigate from a DefaultMutableTreeNode returned from a
breadthFirstEnumeration() to a (J)Component directly?

Thanks to tree-huggers out there.....

0 new messages