jagguli
jagguli

Reputation: 701

java jtree redisplay tooltip for every item after a delay

When a tool tip is displayed on a tree and the mouse is moved the tooltip stays visible and the text changes. Is it possible to hide the tool tip and redisplay it when the mouse moves from one item to the next.

Upvotes: 2

Views: 637

Answers (2)

Sergey
Sergey

Reputation: 1038

you will have to use setToolTipText(null) to remove the tool tip - it will not disappear with our explicitly doing so.

Upvotes: 0

trashgod
trashgod

Reputation: 205785

Extend DefaultTreeCellRenderer and invoke setToolTipText() as required. The tutorial project TreeIconDemo2, discussed in Customizing a Tree's Display, demonstrates the approach.

Addendum: You can supply the desired text for each node in a TreeCellRenderer, e.g. MyRenderer:

    setToolTipText(value + " is in the Tutorial series.");

Upvotes: 1

Related Questions