This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTree font size question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree font size question" Watch "JTree font size question" New topic
Author

JTree font size question

Joe Crew
Ranch Hand

Joined: Apr 02, 2001
Posts: 49
Hello,
I'm using jdk118 and swing 111. I've created a JTree I've also created new [+] and [-] signs that expand and collapse a branch node. I made new ones so they can be larger than standard. I've also created a graphic that replaces the windows system folder icon for nodes that contain children. Again no problem to create it and I created it so it would be larger. Now I want to change the font size to a larger font. I used the typical:
Font tf = new Font("sansserif",Font.PLAIN,16);
tree.setFont(tf);
Again this works, as does everything else does. As you can see from my description above, I am trying to make everything in the JTree larger, the folder icons, the expand/collapse icons, and the font. All of the code works but there is one thing that does not work. The spacing between the text, icons, and/or text strings. For example, say there is 1/4 inch of an inch of space to put you text on a line in the jtree. If I create a font of 24, which I would like to use, the text from one node starts overlapping the lines below and above it. The 1/4 inch space does not increase. The text and icons all over lap. If I create a [+] icon that is over 17 pixels, the icons start overlapping each other. I thought by creating new icons and larger text, the space between each line in the jtree would expand and accomodate them but it hasn't. Has anyone experienced this? Do you have any work arounds? Anything you can tell me on this subject would be appreciated.
Joe Crew
 
Don't get me started about those stupid light bulbs.
 
subject: JTree font size question
 
Similar Threads
custom icons in JTree
Searching a JTree
JTree node names not visible
Help with Jtree node handle icon .
Icon in JTree node