if (restoredSize == null) restoredSize = check.getPreferredSize();
if (restoredSize == null) { restoredSize = new Dimension(check.getPreferredSize().width, DEFAULT_HEIGHT); }
    public Component getTreeCellRendererComponent(JTree tree, Object value,             boolean selected, boolean expanded, boolean leaf, int row,             boolean hasFocus)    {        setEnabled(tree.isEnabled());        if (restoredSize == null) restoredSize = check.getPreferredSize();        TreeCheckNode node = (TreeCheckNode) value;        check.setSelected(node.isSelected());        label.setFont(tree.getFont());        label.setText(node.toString());        label.setSelected(selected);        label.setFocus(hasFocus);        Icon nodeIcon = node.getNodeIcon();        if (node.isLeafNode()) {            if (nodeIcon == null) nodeIcon = UIManager.getIcon("Tree.leafIcon");            check.setPreferredSize(restoredSize);            add(check);            add(label);        } else {            if (nodeIcon == null) {                if (expanded) nodeIcon = UIManager.getIcon("Tree.openIcon");                else nodeIcon = UIManager.getIcon("Tree.closedIcon");            }            if (leafOnly) check.setPreferredSize(NULL_SIZE);            else {                check.setPreferredSize(restoredSize);                add(check);            }             add(label);        }        label.setIcon(nodeIcon);        return this;    }