Underlining a node in JTree
3 Message(s) by 2 Author(s) originally posted in java gui
| From: H?kan Lane |
Date: Thursday, October 11, 2007
|
How do I underline a specific
node in JTree? I have searched a lot for
it on the web, but I did not find anything that has worked. I have been
creating the
tree by adding DefaultMutableTreenode instances. No changes
to the look and feel or to the Renderers have been implemented in the
code for the tree part. Thanks in advance.
Håkan Lane
| From: H?kan Lane |
Date: Thursday, October 11, 2007
|
Thanks for that. I had to override the getTreeCellRendererComponent as
well as the paint
method . The problem is that the method with setting
the underline
attribute in the attribute map doesn't work. This appears
to be a known
bug in JAVA. Warm greetings up to the beautiful university
in Trondheim!!
Håkan Lane
| From: bcd |
Date: Thursday, October 11, 2007
|
In article
<470E3269.5E4A@xxxxxxxxxxx>,
wrote in message:
How do I underline a specific node in JTree?
This is not supported out of the box. You'll have to
write a custom
Renderer (and Editor if you want it to be editable while underlined)
and you'll need to have some way for the Renderer to be able to
deduce if any given node is to be underlined or not (either by using
custom user objects, or through some other mechanism).
This is not really any different from e.g. having different
text
colours in different nodes so if you find an example that does
something along those lines, it should be easy to adapt it to
underlining the text instead.
Cheers,
Bent D
--
Bent Dalager - bcd@xxxxxxxxxxx -
http://www.pvv.org/~bcd
powered by emacs
Next Message: Usability: Which (menu) button?