int () { int w = tree.getVisibleRect().width - 10; Insets insets = tree.getInsets(); w -= insets.left + insets.right; JScrollPane scrollPane = ComponentUtil.getScrollPane(tree); if (scrollPane != null) { JScrollBar sb = scrollPane.getVerticalScrollBar(); if (sb != null) { w -= sb.getWidth(); } } return w; }