Java Code Examples for javax.swing.JTree#DropLocation

The following examples show how to use javax.swing.JTree#DropLocation . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SynthTreeUI.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void repaintDropLocation(JTree.DropLocation loc) {
    if (loc == null) {
        return;
    }

    Rectangle r;

    if (isDropLine(loc)) {
        r = getDropLineRect(loc);
    } else {
        r = tree.getPathBounds(loc.getPath());
        if (r != null) {
            r.x = 0;
            r.width = tree.getWidth();
        }
    }

    if (r != null) {
        tree.repaint(r);
    }
}
 
Example 2
Source File: LayerTreeTransferHandler.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
private static boolean isValidDrag(TransferSupport support, LayerContainer layerContainer) {
    JTree.DropLocation dropLocation = (JTree.DropLocation) support.getDropLocation();
    TreePath treePath = dropLocation.getPath();

    final Object[] path = treePath.getPath();
    for (Object o : path) {
        final Layer layer = (Layer) o;
        if (layer == layerContainer.getDraggedLayer()) {
            return false;
        }
    }

    Layer targetLayer = (Layer) treePath.getLastPathComponent();
    int targetIndex = dropLocation.getChildIndex();
    if (targetIndex == -1) { //  -1 indicates move into other layer
        return targetLayer.isCollectionLayer();
    }

    return true;
}
 
Example 3
Source File: SynthTreeUI.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void repaintDropLocation(JTree.DropLocation loc) {
    if (loc == null) {
        return;
    }

    Rectangle r;

    if (isDropLine(loc)) {
        r = getDropLineRect(loc);
    } else {
        r = tree.getPathBounds(loc.getPath());
        if (r != null) {
            r.x = 0;
            r.width = tree.getWidth();
        }
    }

    if (r != null) {
        tree.repaint(r);
    }
}
 
Example 4
Source File: SynthTreeUI.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void repaintDropLocation(JTree.DropLocation loc) {
    if (loc == null) {
        return;
    }

    Rectangle r;

    if (isDropLine(loc)) {
        r = getDropLineRect(loc);
    } else {
        r = tree.getPathBounds(loc.getPath());
        if (r != null) {
            r.x = 0;
            r.width = tree.getWidth();
        }
    }

    if (r != null) {
        tree.repaint(r);
    }
}
 
Example 5
Source File: SynthTreeUI.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void propertyChange(PropertyChangeEvent event) {
    if (SynthLookAndFeel.shouldUpdateStyle(event)) {
        updateStyle((JTree)event.getSource());
    }

    if ("dropLocation" == event.getPropertyName()) {
        JTree.DropLocation oldValue = (JTree.DropLocation)event.getOldValue();
        repaintDropLocation(oldValue);
        repaintDropLocation(tree.getDropLocation());
    }
}
 
Example 6
Source File: FlatTreeUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected PropertyChangeListener createPropertyChangeListener() {
	if( !wideSelection )
		return super.createPropertyChangeListener();

	return new BasicTreeUI.PropertyChangeHandler() {
		@Override
		public void propertyChange( PropertyChangeEvent e ) {
			super.propertyChange( e );

			if( e.getSource() == tree && e.getPropertyName() == "dropLocation" ) {
				JTree.DropLocation oldValue = (JTree.DropLocation) e.getOldValue();
				repaintWideDropLocation( oldValue );
				repaintWideDropLocation( tree.getDropLocation() );
			}
		}

		private void repaintWideDropLocation(JTree.DropLocation loc) {
			if( loc == null || isDropLine( loc ) )
				return;

			Rectangle r = tree.getPathBounds( loc.getPath() );
			if( r != null )
				tree.repaint( 0, r.y, tree.getWidth(), r.height );
		}
	};
}
 
Example 7
Source File: SeaGlassTreeUI.java    From seaglass with Apache License 2.0 5 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
protected void paintDropLine(Graphics g) {
    JTree.DropLocation loc = tree.getDropLocation();
    if (!isDropLine(loc)) {
        return;
    }

    Color c = (Color) style.get(paintContext, "Tree.dropLineColor");
    if (c != null) {
        g.setColor(c);
        Rectangle rect = getDropLineRect(loc);
        g.fillRect(rect.x, rect.y, rect.width, rect.height);
    }
}
 
Example 8
Source File: SynthTreeUI.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void paintDropLine(Graphics g) {
    JTree.DropLocation loc = tree.getDropLocation();
    if (!isDropLine(loc)) {
        return;
    }

    Color c = (Color)style.get(paintContext, "Tree.dropLineColor");
    if (c != null) {
        g.setColor(c);
        Rectangle rect = getDropLineRect(loc);
        g.fillRect(rect.x, rect.y, rect.width, rect.height);
    }
}
 
Example 9
Source File: SynthTreeUI.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void paintDropLine(Graphics g) {
    JTree.DropLocation loc = tree.getDropLocation();
    if (!isDropLine(loc)) {
        return;
    }

    Color c = (Color)style.get(paintContext, "Tree.dropLineColor");
    if (c != null) {
        g.setColor(c);
        Rectangle rect = getDropLineRect(loc);
        g.fillRect(rect.x, rect.y, rect.width, rect.height);
    }
}
 
Example 10
Source File: SynthTreeUI.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void paintDropLine(Graphics g) {
    JTree.DropLocation loc = tree.getDropLocation();
    if (!isDropLine(loc)) {
        return;
    }

    Color c = (Color)style.get(paintContext, "Tree.dropLineColor");
    if (c != null) {
        g.setColor(c);
        Rectangle rect = getDropLineRect(loc);
        g.fillRect(rect.x, rect.y, rect.width, rect.height);
    }
}
 
Example 11
Source File: SynthTreeUI.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void paintDropLine(Graphics g) {
    JTree.DropLocation loc = tree.getDropLocation();
    if (!isDropLine(loc)) {
        return;
    }

    Color c = (Color)style.get(paintContext, "Tree.dropLineColor");
    if (c != null) {
        g.setColor(c);
        Rectangle rect = getDropLineRect(loc);
        g.fillRect(rect.x, rect.y, rect.width, rect.height);
    }
}
 
Example 12
Source File: PlotConfigurationTreeCellRenderer.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
private void adaptContainerStyle(JTree tree, Object node, boolean selected, boolean expanded, boolean leaf, int row,
		boolean hasFocus, boolean dragging, boolean setForeground) {
	SwingTools.setEnabledRecursive(this, tree.isEnabled());

	Color fg = null;
	Color bg = null;

	boolean highlightingEnabled = RapidMinerGUI.getDragHighlighteMode().equals(DragHighlightMode.FULL);

	JTree.DropLocation dropLocation = tree.getDropLocation();
	if (dropLocation != null && dropLocation.getChildIndex() == -1
			&& tree.getRowForPath(dropLocation.getPath()) == row) {
		fg = TEXT_SELECTED_COLOR;
		bg = SELECTED_COLOR;
	} else if (selected && !dragging) {
		fg = TEXT_SELECTED_COLOR;
		bg = SELECTED_COLOR;
	} else {
		fg = TEXT_NON_SELECTED_COLOR;
		if (highlightingEnabled && dragging) {
			bg = ProcessDrawer.INNER_DRAG_COLOR;
		} else {
			bg = NOT_SELECTED_COLOR;
		}
	}

	if (setForeground) {
		nameLabel.setForeground(fg);
		attributeLabel.setForeground(fg);
	}
	this.setBackground(bg);

	if (hasFocus) {
		this.setBorder(focusBorder);
	} else {
		if (highlightingEnabled && dragging) {
			this.setBorder(draggingNotFocusedBorder);
		} else {
			this.setBorder(nonFocusBorder);
		}
	}
}
 
Example 13
Source File: DefaultTreeCellRenderer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Configures the renderer based on the passed in components.
  * The value is set from messaging the tree with
  * <code>convertValueToText</code>, which ultimately invokes
  * <code>toString</code> on <code>value</code>.
  * The foreground color is set based on the selection and the icon
  * is set based on the <code>leaf</code> and <code>expanded</code>
  * parameters.
  */
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);

    Color fg = null;
    isDropCell = false;

    JTree.DropLocation dropLocation = tree.getDropLocation();
    if (dropLocation != null
            && dropLocation.getChildIndex() == -1
            && tree.getRowForPath(dropLocation.getPath()) == row) {

        Color col = DefaultLookup.getColor(this, ui, "Tree.dropCellForeground");
        if (col != null) {
            fg = col;
        } else {
            fg = getTextSelectionColor();
        }

        isDropCell = true;
    } else if (sel) {
        fg = getTextSelectionColor();
    } else {
        fg = getTextNonSelectionColor();
    }

    setForeground(fg);

    Icon icon = null;
    if (leaf) {
        icon = getLeafIcon();
    } else if (expanded) {
        icon = getOpenIcon();
    } else {
        icon = getClosedIcon();
    }

    if (!tree.isEnabled()) {
        setEnabled(false);
        LookAndFeel laf = UIManager.getLookAndFeel();
        Icon disabledIcon = laf.getDisabledIcon(tree, icon);
        if (disabledIcon != null) icon = disabledIcon;
        setDisabledIcon(icon);
    } else {
        setEnabled(true);
        setIcon(icon);
    }
    setComponentOrientation(tree.getComponentOrientation());

    selected = sel;

    return this;
}
 
Example 14
Source File: DefaultTreeCellRenderer.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
  * Configures the renderer based on the passed in components.
  * The value is set from messaging the tree with
  * <code>convertValueToText</code>, which ultimately invokes
  * <code>toString</code> on <code>value</code>.
  * The foreground color is set based on the selection and the icon
  * is set based on the <code>leaf</code> and <code>expanded</code>
  * parameters.
  */
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);

    Color fg = null;
    isDropCell = false;

    JTree.DropLocation dropLocation = tree.getDropLocation();
    if (dropLocation != null
            && dropLocation.getChildIndex() == -1
            && tree.getRowForPath(dropLocation.getPath()) == row) {

        Color col = DefaultLookup.getColor(this, ui, "Tree.dropCellForeground");
        if (col != null) {
            fg = col;
        } else {
            fg = getTextSelectionColor();
        }

        isDropCell = true;
    } else if (sel) {
        fg = getTextSelectionColor();
    } else {
        fg = getTextNonSelectionColor();
    }

    setForeground(fg);

    Icon icon = null;
    if (leaf) {
        icon = getLeafIcon();
    } else if (expanded) {
        icon = getOpenIcon();
    } else {
        icon = getClosedIcon();
    }

    if (!tree.isEnabled()) {
        setEnabled(false);
        LookAndFeel laf = UIManager.getLookAndFeel();
        Icon disabledIcon = laf.getDisabledIcon(tree, icon);
        if (disabledIcon != null) icon = disabledIcon;
        setDisabledIcon(icon);
    } else {
        setEnabled(true);
        setIcon(icon);
    }
    setComponentOrientation(tree.getComponentOrientation());

    selected = sel;

    return this;
}
 
Example 15
Source File: SeaGlassTreeUI.java    From seaglass with Apache License 2.0 4 votes vote down vote up
private void paintRow(TreeCellRenderer renderer, DefaultTreeCellRenderer dtcr, SeaGlassContext treeContext, SeaGlassContext cellContext,
    Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, Rectangle rowBounds, TreePath path, int row, boolean isExpanded,
    boolean hasBeenExpanded, boolean isLeaf) {
    // Don't paint the renderer if editing this row.
    boolean selected = tree.isRowSelected(row);

    JTree.DropLocation dropLocation = tree.getDropLocation();
    boolean isDrop = dropLocation != null && dropLocation.getChildIndex() == -1 && path == dropLocation.getPath();

    int state = ENABLED;
    if (selected || isDrop) {
        state |= SELECTED;
    }

    if (tree.isFocusOwner() && row == getLeadSelectionRow()) {
        state |= FOCUSED;
    }

    cellContext.setComponentState(state);

    if (dtcr != null && (dtcr.getBorderSelectionColor() instanceof UIResource)) {
        dtcr.setBorderSelectionColor(style.getColor(cellContext, ColorType.FOCUS));
    }
    SeaGlassLookAndFeel.updateSubregion(cellContext, g, rowBounds);
    cellContext.getPainter().paintTreeCellBackground(cellContext, g, rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height);
    cellContext.getPainter().paintTreeCellBorder(cellContext, g, rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height);
    if (editingComponent != null && editingRow == row) {
        return;
    }

    int leadIndex;

    if (tree.hasFocus()) {
        leadIndex = getLeadSelectionRow();
    } else {
        leadIndex = -1;
    }

    Component component = renderer.getTreeCellRendererComponent(tree, path.getLastPathComponent(), selected, isExpanded, isLeaf, row,
        (leadIndex == row));

    rendererPane.paintComponent(g, component, tree, bounds.x, bounds.y, bounds.width, bounds.height, true);
}
 
Example 16
Source File: SynthTreeUI.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
private void paintRow(TreeCellRenderer renderer,
           DefaultTreeCellRenderer dtcr, SynthContext treeContext,
           SynthContext cellContext, Graphics g, Rectangle clipBounds,
           Insets insets, Rectangle bounds, Rectangle rowBounds,
           TreePath path, int row, boolean isExpanded,
           boolean hasBeenExpanded, boolean isLeaf) {
    // Don't paint the renderer if editing this row.
    boolean selected = tree.isRowSelected(row);

    JTree.DropLocation dropLocation = tree.getDropLocation();
    boolean isDrop = dropLocation != null
                     && dropLocation.getChildIndex() == -1
                     && path == dropLocation.getPath();

    int state = ENABLED;
    if (selected || isDrop) {
        state |= SELECTED;
    }

    if (tree.isFocusOwner() && row == getLeadSelectionRow()) {
        state |= FOCUSED;
    }

    cellContext.setComponentState(state);

    if (dtcr != null && (dtcr.getBorderSelectionColor() instanceof
                         UIResource)) {
        dtcr.setBorderSelectionColor(style.getColor(
                                         cellContext, ColorType.FOCUS));
    }
    SynthLookAndFeel.updateSubregion(cellContext, g, rowBounds);
    cellContext.getPainter().paintTreeCellBackground(cellContext, g,
                rowBounds.x, rowBounds.y, rowBounds.width,
                rowBounds.height);
    cellContext.getPainter().paintTreeCellBorder(cellContext, g,
                rowBounds.x, rowBounds.y, rowBounds.width,
                rowBounds.height);
    if (editingComponent != null && editingRow == row) {
        return;
    }

    int leadIndex;

    if (tree.hasFocus()) {
        leadIndex = getLeadSelectionRow();
    }
    else {
        leadIndex = -1;
    }

    Component component = renderer.getTreeCellRendererComponent(
                     tree, path.getLastPathComponent(),
                     selected, isExpanded, isLeaf, row,
                     (leadIndex == row));

    rendererPane.paintComponent(g, component, tree, bounds.x, bounds.y,
                                bounds.width, bounds.height, true);
}
 
Example 17
Source File: DefaultTreeCellRenderer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Configures the renderer based on the passed in components.
  * The value is set from messaging the tree with
  * <code>convertValueToText</code>, which ultimately invokes
  * <code>toString</code> on <code>value</code>.
  * The foreground color is set based on the selection and the icon
  * is set based on the <code>leaf</code> and <code>expanded</code>
  * parameters.
  */
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);

    Color fg = null;
    isDropCell = false;

    JTree.DropLocation dropLocation = tree.getDropLocation();
    if (dropLocation != null
            && dropLocation.getChildIndex() == -1
            && tree.getRowForPath(dropLocation.getPath()) == row) {

        Color col = DefaultLookup.getColor(this, ui, "Tree.dropCellForeground");
        if (col != null) {
            fg = col;
        } else {
            fg = getTextSelectionColor();
        }

        isDropCell = true;
    } else if (sel) {
        fg = getTextSelectionColor();
    } else {
        fg = getTextNonSelectionColor();
    }

    setForeground(fg);

    Icon icon = null;
    if (leaf) {
        icon = getLeafIcon();
    } else if (expanded) {
        icon = getOpenIcon();
    } else {
        icon = getClosedIcon();
    }

    if (!tree.isEnabled()) {
        setEnabled(false);
        LookAndFeel laf = UIManager.getLookAndFeel();
        Icon disabledIcon = laf.getDisabledIcon(tree, icon);
        if (disabledIcon != null) icon = disabledIcon;
        setDisabledIcon(icon);
    } else {
        setEnabled(true);
        setIcon(icon);
    }
    setComponentOrientation(tree.getComponentOrientation());

    selected = sel;

    return this;
}
 
Example 18
Source File: DefaultTreeCellRenderer.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
  * Configures the renderer based on the passed in components.
  * The value is set from messaging the tree with
  * <code>convertValueToText</code>, which ultimately invokes
  * <code>toString</code> on <code>value</code>.
  * The foreground color is set based on the selection and the icon
  * is set based on the <code>leaf</code> and <code>expanded</code>
  * parameters.
  */
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);

    Color fg = null;
    isDropCell = false;

    JTree.DropLocation dropLocation = tree.getDropLocation();
    if (dropLocation != null
            && dropLocation.getChildIndex() == -1
            && tree.getRowForPath(dropLocation.getPath()) == row) {

        Color col = DefaultLookup.getColor(this, ui, "Tree.dropCellForeground");
        if (col != null) {
            fg = col;
        } else {
            fg = getTextSelectionColor();
        }

        isDropCell = true;
    } else if (sel) {
        fg = getTextSelectionColor();
    } else {
        fg = getTextNonSelectionColor();
    }

    setForeground(fg);

    Icon icon = null;
    if (leaf) {
        icon = getLeafIcon();
    } else if (expanded) {
        icon = getOpenIcon();
    } else {
        icon = getClosedIcon();
    }

    if (!tree.isEnabled()) {
        setEnabled(false);
        LookAndFeel laf = UIManager.getLookAndFeel();
        Icon disabledIcon = laf.getDisabledIcon(tree, icon);
        if (disabledIcon != null) icon = disabledIcon;
        setDisabledIcon(icon);
    } else {
        setEnabled(true);
        setIcon(icon);
    }
    setComponentOrientation(tree.getComponentOrientation());

    selected = sel;

    return this;
}
 
Example 19
Source File: SynthTreeUI.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void paintRow(TreeCellRenderer renderer,
           DefaultTreeCellRenderer dtcr, SynthContext treeContext,
           SynthContext cellContext, Graphics g, Rectangle clipBounds,
           Insets insets, Rectangle bounds, Rectangle rowBounds,
           TreePath path, int row, boolean isExpanded,
           boolean hasBeenExpanded, boolean isLeaf) {
    // Don't paint the renderer if editing this row.
    boolean selected = tree.isRowSelected(row);

    JTree.DropLocation dropLocation = tree.getDropLocation();
    boolean isDrop = dropLocation != null
                     && dropLocation.getChildIndex() == -1
                     && path == dropLocation.getPath();

    int state = ENABLED;
    if (selected || isDrop) {
        state |= SELECTED;
    }

    if (tree.isFocusOwner() && row == getLeadSelectionRow()) {
        state |= FOCUSED;
    }

    cellContext.setComponentState(state);

    if (dtcr != null && (dtcr.getBorderSelectionColor() instanceof
                         UIResource)) {
        dtcr.setBorderSelectionColor(style.getColor(
                                         cellContext, ColorType.FOCUS));
    }
    SynthLookAndFeel.updateSubregion(cellContext, g, rowBounds);
    cellContext.getPainter().paintTreeCellBackground(cellContext, g,
                rowBounds.x, rowBounds.y, rowBounds.width,
                rowBounds.height);
    cellContext.getPainter().paintTreeCellBorder(cellContext, g,
                rowBounds.x, rowBounds.y, rowBounds.width,
                rowBounds.height);
    if (editingComponent != null && editingRow == row) {
        return;
    }

    int leadIndex;

    if (tree.hasFocus()) {
        leadIndex = getLeadSelectionRow();
    }
    else {
        leadIndex = -1;
    }

    Component component = renderer.getTreeCellRendererComponent(
                     tree, path.getLastPathComponent(),
                     selected, isExpanded, isLeaf, row,
                     (leadIndex == row));

    rendererPane.paintComponent(g, component, tree, bounds.x, bounds.y,
                                bounds.width, bounds.height, true);
}
 
Example 20
Source File: SynthTreeUI.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private void paintRow(TreeCellRenderer renderer,
           DefaultTreeCellRenderer dtcr, SynthContext treeContext,
           SynthContext cellContext, Graphics g, Rectangle clipBounds,
           Insets insets, Rectangle bounds, Rectangle rowBounds,
           TreePath path, int row, boolean isExpanded,
           boolean hasBeenExpanded, boolean isLeaf) {
    // Don't paint the renderer if editing this row.
    boolean selected = tree.isRowSelected(row);

    JTree.DropLocation dropLocation = tree.getDropLocation();
    boolean isDrop = dropLocation != null
                     && dropLocation.getChildIndex() == -1
                     && path == dropLocation.getPath();

    int state = ENABLED;
    if (selected || isDrop) {
        state |= SELECTED;
    }

    if (tree.isFocusOwner() && row == getLeadSelectionRow()) {
        state |= FOCUSED;
    }

    cellContext.setComponentState(state);

    if (dtcr != null && (dtcr.getBorderSelectionColor() instanceof
                         UIResource)) {
        dtcr.setBorderSelectionColor(style.getColor(
                                         cellContext, ColorType.FOCUS));
    }
    SynthLookAndFeel.updateSubregion(cellContext, g, rowBounds);
    cellContext.getPainter().paintTreeCellBackground(cellContext, g,
                rowBounds.x, rowBounds.y, rowBounds.width,
                rowBounds.height);
    cellContext.getPainter().paintTreeCellBorder(cellContext, g,
                rowBounds.x, rowBounds.y, rowBounds.width,
                rowBounds.height);
    if (editingComponent != null && editingRow == row) {
        return;
    }

    int leadIndex;

    if (tree.hasFocus()) {
        leadIndex = getLeadSelectionRow();
    }
    else {
        leadIndex = -1;
    }

    Component component = renderer.getTreeCellRendererComponent(
                     tree, path.getLastPathComponent(),
                     selected, isExpanded, isLeaf, row,
                     (leadIndex == row));

    rendererPane.paintComponent(g, component, tree, bounds.x, bounds.y,
                                bounds.width, bounds.height, true);
}