Java Code Examples for javax.swing.tree.DefaultTreeCellRenderer#getBorderSelectionColor()
The following examples show how to use
javax.swing.tree.DefaultTreeCellRenderer#getBorderSelectionColor() .
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 jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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 2
Source File: SynthTreeUI.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
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 3
Source File: SeaGlassTreeUI.java From seaglass with Apache License 2.0 | 4 votes |
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 4
Source File: SynthTreeUI.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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 5
Source File: SynthTreeUI.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
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 6
Source File: SynthTreeUI.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
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 7
Source File: SynthTreeUI.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
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 8
Source File: SynthTreeUI.java From hottub with GNU General Public License v2.0 | 4 votes |
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 9
Source File: SynthTreeUI.java From Java8CN with Apache License 2.0 | 4 votes |
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 10
Source File: SynthTreeUI.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
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 11
Source File: SynthTreeUI.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
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 12
Source File: SynthTreeUI.java From Bytecoder with Apache License 2.0 | 4 votes |
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 13
Source File: SynthTreeUI.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
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 14
Source File: SynthTreeUI.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
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 15
Source File: SynthTreeUI.java From JDKSourceCode1.8 with MIT License | 4 votes |
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 16
Source File: SynthTreeUI.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
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: SynthTreeUI.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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 18
Source File: SynthTreeUI.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
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); }