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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zzynxSr. Software engineerCommented:
yourTree.putClientProperty("JTree.lineStyle", "Angled");

See @ http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
(paragraph "Customizing a Tree's Display")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zzynxSr. Software 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
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?
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

iAwinAuthor Commented:

>>jrett docs?

jtree docs
zzynxSr. Software 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
iAwinAuthor Commented:

sorry, let me pre - phrase, The properties "JTree.lineStyle", "Angled" are not mentioned in the docs?
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...
zzynxSr. Software engineerCommented:
>> id just like to know where to look for different properties
afaik, the link I gave you tells it all
zzynxSr. Software engineerCommented:
I mean: afaik, that's all there is
zzynxSr. Software 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));
iAwinAuthor Commented:

ok, ;-) thanks
zzynxSr. Software engineerCommented:
Thanx 4 axxepting
iAwinAuthor Commented:

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

How do you mean?
zzynxSr. Software 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



iAwinAuthor Commented:

oh ok, thanks again
zzynxSr. Software engineerCommented:
No problem
sciuriwareCommented:
Thanks zzynx, I was also eager to learn about this.
;JOOP!
zzynxSr. Software engineerCommented:
You're welcome
;°)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.