Component (JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { setFont(UIUtil.getTreeFont()); initComponent(tree, value, selected, expanded, leaf, row, hasFocus); mySelected = selected; myHasFocus = hasFocus; myTree = tree; int availWidth = getAvailableWidth(value, tree); if (availWidth > 0) { setSize(availWidth, 100); // height will be calculated automatically } int leftInset = myLabelInsets.left; if (myIcon != null) { leftInset += myIcon.getIconWidth() + 2; } if (!StringUtil.isEmpty(myPrefix)) { myPrefixWidth = getCurrFontMetrics().stringWidth(myPrefix) + 5; leftInset += myPrefixWidth; } setTextInsets(new Insets(myLabelInsets.top, leftInset, myLabelInsets.bottom, myLabelInsets.right)); if (myIcon != null) { setMinHeight(myIcon.getIconHeight()); } else { setMinHeight(1); } setSize(getPreferredSize()); recalculateWraps(); return this; }