Have the row height for each row computed individually
import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTree; public class TreeRowHeightCalculation { public static void main(String[] argv) { JTree tree = new JTree(); tree.setRowHeight(0); JFrame frame = new JFrame("tree row height calculation"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(tree)); frame.setSize(380, 320); frame.setLocationRelativeTo(null); frame.setVisible(true); } }