javax.swing.plaf.basic.BasicGraphicsUtils#drawDashedRect ( )源码实例Demo

下面列出了javax.swing.plaf.basic.BasicGraphicsUtils#drawDashedRect ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

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);
    }
}
 
源代码2 项目: dragonwell8_jdk   文件: DefaultTreeCellRenderer.java
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);
    }
}
 
源代码3 项目: jdk8u-jdk   文件: DefaultTreeCellRenderer.java
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);
    }
}
 
源代码4 项目: jdk8u60   文件: DefaultTreeCellRenderer.java
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);
    }
}
 
源代码5 项目: hottub   文件: DefaultTreeCellRenderer.java
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);
    }
}
 
源代码6 项目: Bytecoder   文件: DefaultTreeCellRenderer.java
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);
    }
}
 
源代码7 项目: jdk8u-jdk   文件: DefaultTreeCellRenderer.java
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);
    }
}
 
源代码8 项目: java-swing-tips   文件: MainPanel.java
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);
  }
}
 
源代码9 项目: jdk8u-dev-jdk   文件: BorderedComponent.java
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);
    }
}
 
源代码10 项目: visualvm   文件: BorderedComponent.java
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);
    }
}
 
源代码11 项目: jdk8u60   文件: BorderedComponent.java
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);
    }
}
 
源代码12 项目: openjdk-jdk8u   文件: BorderedComponent.java
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);
    }
}
 
源代码13 项目: jdk8u_jdk   文件: BorderedComponent.java
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);
    }
}
 
源代码14 项目: netbeans   文件: WindowsSlidingButtonUI.java
@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);
   }
 
源代码15 项目: openjdk-jdk8u-backup   文件: BorderedComponent.java
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);
    }
}
 
源代码16 项目: openjdk-jdk9   文件: BorderedComponent.java
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);
    }
}
 
源代码17 项目: microba   文件: WindowsMarkerBarUI.java
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);
}
 
源代码18 项目: jdk8u-jdk   文件: BorderedComponent.java
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);
    }
}
 
源代码19 项目: microba   文件: BasicMarkerBarUI.java
protected void drawFocusRect(Graphics g, Rectangle viewRect) {
	g.setColor(getFocusColor());

	BasicGraphicsUtils.drawDashedRect(g, viewRect.x, viewRect.y, viewRect.width,
			viewRect.height);
}
 
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);
}