下面列出了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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
@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);
}
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);
}
}
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);
}
}
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);
}
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);
}
}
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);
}