Java Code Examples for javax.swing.plaf.basic.BasicGraphicsUtils#drawDashedRect()

The following examples show how to use javax.swing.plaf.basic.BasicGraphicsUtils#drawDashedRect() . 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: DefaultTreeCellRenderer.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private void paintFocus(Graphics g, int x, int y, int w, int h, Color notColor) {
    Color       bsColor = getBorderSelectionColor();

    if (bsColor != null && (selected || !drawDashedFocusIndicator)) {
        g.setColor(bsColor);
        g.drawRect(x, y, w - 1, h - 1);
    }
    if (drawDashedFocusIndicator && notColor != null) {
        if (treeBGColor != notColor) {
            treeBGColor = notColor;
            focusBGColor = new Color(~notColor.getRGB());
        }
        g.setColor(focusBGColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
    }
}
 
Example 2
Source File: DefaultTreeCellRenderer.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void paintFocus(Graphics g, int x, int y, int w, int h, Color notColor) {
    Color       bsColor = getBorderSelectionColor();

    if (bsColor != null && (selected || !drawDashedFocusIndicator)) {
        g.setColor(bsColor);
        g.drawRect(x, y, w - 1, h - 1);
    }
    if (drawDashedFocusIndicator && notColor != null) {
        if (treeBGColor != notColor) {
            treeBGColor = notColor;
            focusBGColor = new Color(~notColor.getRGB());
        }
        g.setColor(focusBGColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
    }
}
 
Example 3
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
private void paintFocusRect(Graphics g, int x, int y, int w, int h, Color notColor) {
  Color bsColor = getBorderSelectionColor();
  boolean b = selected || !drawDashedFocusIndicator;
  if (Objects.nonNull(bsColor) && b) {
    g.setColor(bsColor);
    g.drawRect(x, y, w - 1, h - 1);
  }
  if (drawDashedFocusIndicator && Objects.nonNull(notColor)) {
    if (!notColor.equals(treeBgsColor)) {
      treeBgsColor = notColor;
      focusBgsColor = new Color(~notColor.getRGB());
    }
    g.setColor(focusBgsColor);
    BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
  }
}
 
Example 4
Source File: DefaultTreeCellRenderer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void paintFocus(Graphics g, int x, int y, int w, int h, Color notColor) {
    Color       bsColor = getBorderSelectionColor();

    if (bsColor != null && (selected || !drawDashedFocusIndicator)) {
        g.setColor(bsColor);
        g.drawRect(x, y, w - 1, h - 1);
    }
    if (drawDashedFocusIndicator && notColor != null) {
        if (treeBGColor != notColor) {
            treeBGColor = notColor;
            focusBGColor = new Color(~notColor.getRGB());
        }
        g.setColor(focusBGColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
    }
}
 
Example 5
Source File: DefaultTreeCellRenderer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void paintFocus(Graphics g, int x, int y, int w, int h, Color notColor) {
    Color       bsColor = getBorderSelectionColor();

    if (bsColor != null && (selected || !drawDashedFocusIndicator)) {
        g.setColor(bsColor);
        g.drawRect(x, y, w - 1, h - 1);
    }
    if (drawDashedFocusIndicator && notColor != null) {
        if (treeBGColor != notColor) {
            treeBGColor = notColor;
            focusBGColor = new Color(~notColor.getRGB());
        }
        g.setColor(focusBGColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
    }
}
 
Example 6
Source File: DefaultTreeCellRenderer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void paintFocus(Graphics g, int x, int y, int w, int h, Color notColor) {
    Color       bsColor = getBorderSelectionColor();

    if (bsColor != null && (selected || !drawDashedFocusIndicator)) {
        g.setColor(bsColor);
        g.drawRect(x, y, w - 1, h - 1);
    }
    if (drawDashedFocusIndicator && notColor != null) {
        if (treeBGColor != notColor) {
            treeBGColor = notColor;
            focusBGColor = new Color(~notColor.getRGB());
        }
        g.setColor(focusBGColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
    }
}
 
Example 7
Source File: DefaultTreeCellRenderer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void paintFocus(Graphics g, int x, int y, int w, int h, Color notColor) {
    Color       bsColor = getBorderSelectionColor();

    if (bsColor != null && (selected || !drawDashedFocusIndicator)) {
        g.setColor(bsColor);
        g.drawRect(x, y, w - 1, h - 1);
    }
    if (drawDashedFocusIndicator && notColor != null) {
        if (treeBGColor != notColor) {
            treeBGColor = notColor;
            focusBGColor = new Color(~notColor.getRGB());
        }
        g.setColor(focusBGColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
    }
}
 
Example 8
Source File: DefaultTreeCellRenderer.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
private void paintFocus(Graphics g, int x, int y, int w, int h, Color notColor) {
    Color       bsColor = getBorderSelectionColor();

    if (bsColor != null && (selected || !drawDashedFocusIndicator)) {
        g.setColor(bsColor);
        g.drawRect(x, y, w - 1, h - 1);
    }
    if (drawDashedFocusIndicator && notColor != null) {
        if (treeBGColor != notColor) {
            treeBGColor = notColor;
            focusBGColor = new Color(~notColor.getRGB());
        }
        g.setColor(focusBGColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
    }
}
 
Example 9
Source File: BorderedComponent.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if (comp.hasFocus() || focusLostTemporarily) {
        Color color = g.getColor();
        g.setColor(focusColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, width, height);
        g.setColor(color);
    }
}
 
Example 10
Source File: BorderedComponent.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if (comp.hasFocus() || focusLostTemporarily) {
        Color color = g.getColor();
        g.setColor(focusColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, width, height);
        g.setColor(color);
    }
}
 
Example 11
Source File: WindowsMarkerBarUI.java    From microba with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void drawFocusRect(Graphics g, Rectangle viewRect) {
	g.setColor(getFocusColor());

	g.setColor(getFocusColor());
	// BasicGraphicsUtils.drawDashedRect(g, dashedRectGapX, dashedRectGapY,
	// viewRect.width - dashedRectGapWidth, viewRect.height
	// - dashedRectGapHeight);
	BasicGraphicsUtils.drawDashedRect(g, viewRect.x, viewRect.y, viewRect.width - 1,
			viewRect.height - 1);
}
 
Example 12
Source File: BorderedComponent.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if (comp.hasFocus() || focusLostTemporarily) {
        Color color = g.getColor();
        g.setColor(focusColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, width, height);
        g.setColor(color);
    }
}
 
Example 13
Source File: BorderedComponent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if (comp.hasFocus() || focusLostTemporarily) {
        Color color = g.getColor();
        g.setColor(focusColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, width, height);
        g.setColor(color);
    }
}
 
Example 14
Source File: WindowsSlidingButtonUI.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
   protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect){

int width = b.getWidth();
int height = b.getHeight();
g.setColor(getFocusColor());
BasicGraphicsUtils.drawDashedRect(g, dashedRectGapX, dashedRectGapY,
				  width - dashedRectGapWidth, height - dashedRectGapHeight);
   }
 
Example 15
Source File: BorderedComponent.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if (comp.hasFocus() || focusLostTemporarily) {
        Color color = g.getColor();
        g.setColor(focusColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, width, height);
        g.setColor(color);
    }
}
 
Example 16
Source File: BorderedComponent.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if (comp.hasFocus() || focusLostTemporarily) {
        Color color = g.getColor();
        g.setColor(focusColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, width, height);
        g.setColor(color);
    }
}
 
Example 17
Source File: BorderedComponent.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if (comp.hasFocus() || focusLostTemporarily) {
        Color color = g.getColor();
        g.setColor(focusColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, width, height);
        g.setColor(color);
    }
}
 
Example 18
Source File: BorderedComponent.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if (comp.hasFocus() || focusLostTemporarily) {
        Color color = g.getColor();
        g.setColor(focusColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, width, height);
        g.setColor(color);
    }
}
 
Example 19
Source File: BasicMarkerBarUI.java    From microba with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
protected void drawFocusRect(Graphics g, Rectangle viewRect) {
	g.setColor(getFocusColor());

	BasicGraphicsUtils.drawDashedRect(g, viewRect.x, viewRect.y, viewRect.width,
			viewRect.height);
}
 
Example 20
Source File: BasicTaskPaneGroupUI.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
public void paintBorder(
  Component c,
  Graphics g,
  int x,
  int y,
  int width,
  int height) {

  JTaskPaneGroup group = (JTaskPaneGroup)c;

  // calculate position of title and toggle controls
  int controlWidth = TITLE_HEIGHT - 2 * ROUND_HEIGHT;
  int controlX = group.getWidth() - TITLE_HEIGHT;
  int controlY = ROUND_HEIGHT - 1;
  int titleX = 3;
  int titleY = 0;
  int titleWidth = group.getWidth() - getTitleHeight() - 3;
  int titleHeight = getTitleHeight();
  
  if (!group.getComponentOrientation().isLeftToRight()) {
    controlX = group.getWidth() - controlX - controlWidth;        
    titleX = group.getWidth() - titleX - titleWidth;
  }
  
  // paint the title background
  paintTitleBackground(group, g);

  // paint the the toggles
  paintExpandedControls(group, g, controlX, controlY, controlWidth,
    controlWidth);

  // paint the title text and icon
  Color paintColor = getPaintColor(group);

  // focus painted same color as text
  if (group.hasFocus()) {
    g.setColor(paintColor);
    BasicGraphicsUtils.drawDashedRect(
      g,
      3,
      3,
      width - 6,
      getTitleHeight() - 6);
  }

  paintTitle(
    group,
    g,
    paintColor,
    titleX,
    titleY,
    titleWidth,
    titleHeight);
}