Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTree font size question

 
Joe Crew
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic