add node border lines to jtree that has windows look and feel


Hi all,

I have a jtree with the windows look and feel, im just wondering how can I add the lines between the various nodes. By lines I mean that in the java look and feel when a node is expanded a vertical and horizantal line appears to indicated the new nodes location.

Thanks
iAwinAsked:
Who is Participating?
 
zzynxSoftware engineerCommented:
yourTree.putClientProperty("JTree.lineStyle", "Angled");

See @ http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
(paragraph "Customizing a Tree's Display")
0
 
zzynxSoftware engineerCommented:
Remark: I don't see the lines when running on java 1.4.2
              I do see them when running on java 1.5
0
 
iAwinAuthor Commented:

Thats perfect zzynx, thanks.

Im just confused as to how you found that out cos i did'nt see the putClientProperty anywhere in the jrett docs?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
iAwinAuthor Commented:

>>jrett docs?

jtree docs
0
 
zzynxSoftware engineerCommented:
>> i did'nt see the putClientProperty anywhere in the jrett docs?
putClientProperty() is a method of JComponent (and a JTree is also a JComponent)

It's mentioned in the link I gave you
0
 
iAwinAuthor Commented:

sorry, let me pre - phrase, The properties "JTree.lineStyle", "Angled" are not mentioned in the docs?
0
 
iAwinAuthor Commented:

The reason I ask is that I may want to change the appearance and id just like to know where to look for different properties...
0
 
zzynxSoftware engineerCommented:
>> id just like to know where to look for different properties
afaik, the link I gave you tells it all
0
 
zzynxSoftware engineerCommented:
I mean: afaik, that's all there is
0
 
zzynxSoftware engineerCommented:
Well, when @ http://www.rgagnon.com/javadetails/JavaUIDefaults.txt you search for "Tree"
you'll see that some other things can be changed too.
But when changing those you change them for ALL your JTree's.

e.g.
UIManager.put("Tree.font", new Font("Serif", Font.ITALIC, 12));
0
 
iAwinAuthor Commented:

ok, ;-) thanks
0
 
zzynxSoftware engineerCommented:
Thanx 4 axxepting
0
 
iAwinAuthor Commented:

>>But when changing those you change them for ALL your JTree's.

How do you mean?
0
 
zzynxSoftware engineerCommented:
yourTree.putClientProperty("JTree.lineStyle", "Angled");

only influences the JTree instance yourTree.

while calling

UIManager.put("Tree.font", new Font("Serif", Font.ITALIC, 12));

influences all JTree instances you use in your app



0
 
iAwinAuthor Commented:

oh ok, thanks again
0
 
zzynxSoftware engineerCommented:
No problem
0
 
sciuriwareCommented:
Thanks zzynx, I was also eager to learn about this.
;JOOP!
0
 
zzynxSoftware engineerCommented:
You're welcome
;°)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.