public Component getTreeCellRendererComponent(JTree tree, Object value,
                                                  boolean sel,
                                                  boolean expanded,
                                                  boolean leaf, int row,
                                                  boolean hasFocus) {
        String         stringValue = tree.convertValueToText(value, sel,
                expanded, leaf, row, hasFocus);

        this.tree = tree;
        this.hasFocus = hasFocus;
        setText(stringValue);
        if(sel)
            setForeground(getTextSelectionColor());
        else
        {
            if (value instanceof SingleTreeNode)
                setForeground(Color.black);
            else if (value instanceof ComparatorTreeNode)
                setForeground(((ComparatorTreeNode) value).getColor());
        }
        setComponentOrientation(tree.getComponentOrientation());

        selected = sel;

        return this;
    }