當前位置: 首頁>>代碼示例>>Java>>正文


Java BasicGraphicsUtils.drawDashedRect方法代碼示例

本文整理匯總了Java中javax.swing.plaf.basic.BasicGraphicsUtils.drawDashedRect方法的典型用法代碼示例。如果您正苦於以下問題:Java BasicGraphicsUtils.drawDashedRect方法的具體用法?Java BasicGraphicsUtils.drawDashedRect怎麽用?Java BasicGraphicsUtils.drawDashedRect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.plaf.basic.BasicGraphicsUtils的用法示例。


在下文中一共展示了BasicGraphicsUtils.drawDashedRect方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: paintFocus

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
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);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:DefaultTreeCellRenderer.java

示例2: paintFocus

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
protected void paintFocus(
  Graphics g,
  AbstractButton b,
  Rectangle viewRect,
  Rectangle textRect,
  Rectangle iconRect) {
  if (b.getParent() instanceof JToolBar) {
    // Windows doesn't draw the focus rect for buttons in a toolbar.
    return;
  }

  // focus painted same color as text
  int width = b.getWidth();
  int height = b.getHeight();
  g.setColor(getFocusColor());
  BasicGraphicsUtils.drawDashedRect(
    g,
    dashedRectGapX,
    dashedRectGapY,
    width - dashedRectGapWidth,
    height - dashedRectGapHeight);
}
 
開發者ID:mstritt,項目名稱:orbit-image-analysis,代碼行數:23,代碼來源:BasicLinkButtonUI.java

示例3: paintFocus

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
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);
	}
}
 
開發者ID:DigitalMediaServer,項目名稱:DigitalMediaServer,代碼行數:17,代碼來源:RepaintableTreeCellRenderer.java

示例4: paintFocus

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
private void paintFocus(Graphics g, int x, int y, int w, int h, Color notColor) {
    Color bsColor = getBorderSelectionColor();

    if (bsColor != null && (selected || !drawDashedFocusIndicator) && drawSolidFocusIndicator) {
        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);
    }
}
 
開發者ID:JCheckboxTree,項目名稱:JCheckboxTree,代碼行數:17,代碼來源:CustomDefaultTreeCellRenderer.java

示例5: paintBorder

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
@Override
public void paintBorder(Component c, Graphics g, int x, int y,
        int width, int height) {
    Color color = UIManager.getColor("Tree.selectionBorderColor");
    if (color != null) {
        lineColor = color;
    }
    if (isDashed()) {
        if (treeBackground != c.getBackground()) {
            treeBackground = c.getBackground();
            focusColor = new Color(~treeBackground.getRGB());
        }

        Color old = g.getColor();
        g.setColor(focusColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, width, height);
        g.setColor(old);

    } else {
        super.paintBorder(c, g, x, y, width, height);
    }

}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:24,代碼來源:TreeCellContext.java

示例6: paintFocus

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
@Override
    protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect,
            Rectangle textRect, Rectangle iconRect) {
        if (b.getParent() instanceof JToolBar) {
            // Windows doesn't draw the focus rect for buttons in a toolbar.
            return;
        }

        // focus painted same color as text
        g.setColor(getFocusColor());
        // paint the focus rect around the union of text rect and icon rect
        // PENDING JW: duplicated to handle insets
        Rectangle iconTextRect = getIconTextRect(b); 
        // PENDING JW: better factor handling of insets - the bare union doesn't respect insets
//        Rectangle iconTextRect = textRect.union(iconRect);
        BasicGraphicsUtils.drawDashedRect(g, iconTextRect.x, iconTextRect.y, 
                iconTextRect.width, iconTextRect.height);
        // pre-#167-swingx: active area too large
//        int width = b.getWidth();
//        int height = b.getHeight();
//        BasicGraphicsUtils.drawDashedRect(g, dashedRectGapX, dashedRectGapY,
//                width - dashedRectGapWidth, height - dashedRectGapHeight);
    }
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:24,代碼來源:BasicHyperlinkUI.java

示例7: paintFocus

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
private void paintFocus(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(treeBGColor)) {
            treeBGColor = notColor;
            focusBGColor = new Color(~notColor.getRGB());
        }
        g.setColor(focusBGColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
    }
}
 
開發者ID:aterai,項目名稱:java-swing-tips,代碼行數:17,代碼來源:MainPanel.java

示例8: paintFocusIndicator

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
@Override
protected void paintFocusIndicator(
    Graphics g,
    int tabPlacement,
    Rectangle[] rectangles,
    int tabIndex,
    Rectangle iconRect,
    Rectangle textRect,
    boolean isSelected) {
    if (!hasEmbeddedTabs()) {
        super.paintFocusIndicator(g, tabPlacement, rectangles, tabIndex, iconRect, textRect, isSelected);
        return;
    }
    if (tabPane.hasFocus() && isSelected) {
        g.setColor(focus);
        BasicGraphicsUtils.drawDashedRect(g, textRect.x - 2, textRect.y, textRect.width + 3, textRect.height);
    }
}
 
開發者ID:javachen,項目名稱:IBMDataMovementTool,代碼行數:19,代碼來源:WindowsTabbedPaneUI.java

示例9: paintFocus

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
private void paintFocus(Graphics g, int x, int y, int w, int h) {
    Color       bsColor = getBorderSelectionColor();

    if (bsColor != null && (selected || !drawDashedFocusIndicator)) {
        g.setColor(bsColor);
        g.drawRect(x, y, w - 1, h - 1);
    }
    if (drawDashedFocusIndicator) {
        Color color;
        if (selected) {
            color = getBackgroundSelectionColor();
        } else {
            color = getBackgroundNonSelectionColor();
            if(color == null) {
                color = getBackground();
            }
        }

        if (treeBGColor != color) {
            treeBGColor = color;
            focusBGColor = new Color(~color.getRGB());
        }
        g.setColor(focusBGColor);
        BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
    }
}
 
開發者ID:DmitriyKartashov,項目名稱:SwingTreeAnalyzer,代碼行數:27,代碼來源:TreeAnalyzerCellRenderer.java

示例10: paintFocus

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
    Graphics2D g2D = (Graphics2D) g;
    int width = b.getWidth();
    int height = b.getHeight();
    if (!b.isContentAreaFilled()
            || ((width < 64) || (height < 16)) && ((b.getText() == null) || b.getText().equals(""))) {
        g.setColor(AbstractLookAndFeel.getFocusColor());
        BasicGraphicsUtils.drawDashedRect(g, 4, 3, width - 8, height - 6);
    } else {
        Object savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
        g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2D.setColor(AbstractLookAndFeel.getFocusColor());
        int d = height - 6;
        g2D.drawRoundRect(2, 2, width - 7, height - 7, d, d);
        g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRenderingHint);
    }
}
 
開發者ID:visit,項目名稱:spark-svn-mirror,代碼行數:18,代碼來源:MintButtonUI.java

示例11: paintFocus

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
@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);
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:WindowsSlidingButtonUI.java

示例12: paintBorder

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
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);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:9,代碼來源:BorderedComponent.java

示例13: paintBorder

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h)
{
	super.paintBorder(c, g, x, y, w, h);

	if(focused && focusEnabled)
	{
		g.setColor(Theme.FOCUS_COLOR);
		BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
	}
}
 
開發者ID:andy-goryachev,項目名稱:PasswordSafe,代碼行數:11,代碼來源:CTableRendererBorder.java

示例14: paintBorder

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
{
	Color oldColor = g.getColor();
	int i;

	g.setColor(lineColor);
	for(i = 0; i < thickness; i++)
	{
		// FIX stroke
		BasicGraphicsUtils.drawDashedRect(g, x + i, y + i, width - i - i, height - i - i);
	}
	g.setColor(oldColor);
}
 
開發者ID:andy-goryachev,項目名稱:PasswordSafe,代碼行數:14,代碼來源:CDashedBorder.java

示例15: paintFocus

import javax.swing.plaf.basic.BasicGraphicsUtils; //導入方法依賴的package包/類
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 + getTextShiftOffset(), 
		dashedRectGapY + getTextShiftOffset(), 
		width - dashedRectGapWidth, 
		height - dashedRectGapHeight
	);
}
 
開發者ID:andy-goryachev,項目名稱:PasswordSafe,代碼行數:15,代碼來源:AgButtonUI.java


注:本文中的javax.swing.plaf.basic.BasicGraphicsUtils.drawDashedRect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。