本文整理匯總了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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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
);
}