setting height of rows in jtree

hi,

In a JTree I've created, the row height is the same size as my icon height. I'd like to make the row height slightly bigger to make the tree appear a bit more spacious. However I am unable to change the sizing.

I've tried:

myJTree.setRowHeight(height)

myRenderer.setSize(width, height)

which seem to have no effect, and:

myRenderer.setPreferredSize(new Dimension(width,height))

which allows me to set the width but not the height. If I print out the height it is always set to 0.0. Can anyone help?

thanks in advance,

Matt

[598 byte] By [matt797] at [2007-9-26 12:25:23]
# 1

overide the method getRowHeight() of the JTree

public int getRowHeight()

{

int height = super.getRowHeight();

height += myIcon.getIconHeight() / 2;

/* the above code may place the icon in center of the row or u may also try

height += myIcon.getIconHeight(); */

return height;

}

gkrao78 at 2007-7-2 3:06:17 > top of Java-index,Archived Forums,Swing...
# 2
Thanks! That worked just fine. matt
matt797 at 2007-7-2 3:06:17 > top of Java-index,Archived Forums,Swing...