This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTree and indent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree and indent" Watch "JTree and indent" New topic
Author

JTree and indent

Mika Leino
Ranch Hand

Joined: Jan 07, 2002
Posts: 56
Is there any way to modify the indent of a JTree's nodes? The practical width of my JTree is'nt very much, so I would like to display the nodes more tightly.

[ January 15, 2002: Message edited by: Mika Leino ]

Mika Leino<br />SCJP, SCWCD
Vinod Venugopal
Ranch Hand

Joined: Dec 06, 2000
Posts: 148
You could try tree.setRowHeight(int) to set the height of each row.
Vinod


- Vinod<br />-------<br />SCJP2
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
Hi Mika,
Yes Mika,
You can set the tree indent for the whole application like this:

Hope that helps,
[ January 15, 2002: Message edited by: Terence Doyle ]
[ January 15, 2002: Message edited by: Terence Doyle ]

Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
Mika Leino
Ranch Hand

Joined: Jan 07, 2002
Posts: 56
Thank you very much Terry. I got just the result I was looking for using that bit of code.
jenita brown
Ranch Hand

Joined: Feb 20, 2007
Posts: 51
hello,

My requirement is slightly different. If you notice, JTree indents the leaf nodes more then a normal node. I want to override this action and get all the children aligned, irrespective of node type.

Regards,

Jenal
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

Jenal, use one thread per question. You have your own thread for this question. And as Rob C said there, this post is considered a thread hijack; please don't do that anymore, ok?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
 
subject: JTree and indent
 
Similar Threads
Updating a JTree
JTree
Searching a JTree
Expanding a Specific Node in JTree
Subtree in JTree