Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-03-23
18
Medium Priority
?
491 Views
Last Modified: 2008-03-04

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
0
Comment
Question by:iAwin
  • 10
  • 7
18 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 600 total points
ID: 16268629
yourTree.putClientProperty("JTree.lineStyle", "Angled");

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

Expert Comment

by:zzynx
ID: 16268653
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
 

Author Comment

by:iAwin
ID: 16268934

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:iAwin
ID: 16268985

>>jrett docs?

jtree docs
0
 
LVL 37

Expert Comment

by:zzynx
ID: 16269022
>> 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
 

Author Comment

by:iAwin
ID: 16269100

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

Author Comment

by:iAwin
ID: 16269108

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
 
LVL 37

Expert Comment

by:zzynx
ID: 16269135
>> id just like to know where to look for different properties
afaik, the link I gave you tells it all
0
 
LVL 37

Expert Comment

by:zzynx
ID: 16269146
I mean: afaik, that's all there is
0
 
LVL 37

Expert Comment

by:zzynx
ID: 16269216
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
 

Author Comment

by:iAwin
ID: 16269377

ok, ;-) thanks
0
 
LVL 37

Expert Comment

by:zzynx
ID: 16269414
Thanx 4 axxepting
0
 

Author Comment

by:iAwin
ID: 16269508

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

How do you mean?
0
 
LVL 37

Expert Comment

by:zzynx
ID: 16269538
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
 

Author Comment

by:iAwin
ID: 16269629

oh ok, thanks again
0
 
LVL 37

Expert Comment

by:zzynx
ID: 16269649
No problem
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 16270339
Thanks zzynx, I was also eager to learn about this.
;JOOP!
0
 
LVL 37

Expert Comment

by:zzynx
ID: 16270362
You're welcome
;°)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question