当前位置: 首页>>代码示例>>Java>>正文


Java AbstractButton.isContentAreaFilled方法代码示例

本文整理汇总了Java中javax.swing.AbstractButton.isContentAreaFilled方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractButton.isContentAreaFilled方法的具体用法?Java AbstractButton.isContentAreaFilled怎么用?Java AbstractButton.isContentAreaFilled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.AbstractButton的用法示例。


在下文中一共展示了AbstractButton.isContentAreaFilled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawToolbarButton

import javax.swing.AbstractButton; //导入方法依赖的package包/类
/**
 * Drasw a button in a toolbar.
 *
 * @param b
 *            the button
 * @param g
 *            the graphics instance
 */
public static void drawToolbarButton(Graphics g, AbstractButton b) {
	if (!b.isEnabled()) {
		return;
	}

	if (b.getModel().isSelected() && b.isRolloverEnabled() || b.getModel().isPressed() && b.getModel().isArmed()
			&& b.isRolloverEnabled()) {
		if (b.isContentAreaFilled()) {
			drawButton(b, g, createShapeForButton(b));
		}
		if (b.isBorderPainted()) {
			drawButtonBorder(b, g, createBorderShapeForButton(b));
		}
	} else if (b.getModel().isRollover() && b.isRolloverEnabled()) {
		if (b.isBorderPainted()) {
			drawButtonBorder(b, g, createBorderShapeForButton(b));
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:28,代码来源:RapidLookTools.java

示例2: paint

import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {
	AbstractButton b = (AbstractButton) c;
	if (RapidLookTools.isToolbarButton(b)) {
		RapidLookTools.drawToolbarButton(g, b);
		super.paint(g, c);
		return;
	}

	int w = c.getWidth();
	int h = c.getHeight();
	if (w <= 0 || h <= 0) {
		return;
	}

	if (b.isContentAreaFilled()) {
		RapidLookTools.drawButton(b, g, RapidLookTools.createShapeForButton(b));
	}
	if (b.isBorderPainted()) {
		RapidLookTools.drawButtonBorder(b, g, RapidLookTools.createBorderShapeForButton(b));
	}
	super.paint(g, c);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:24,代码来源:ButtonUI.java

示例3: paintButtonPressed

import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
protected void paintButtonPressed(Graphics g, AbstractButton b) {
	if (b.isContentAreaFilled()) {
		if (RapidLookTools.isToolbarButton(b)) {
			RapidLookTools.drawToolbarButton(g, b);
		} else {
			RapidLookTools.drawButton(b, g, RapidLookTools.createShapeForButton(b));
		}
	}
	setTextShiftOffset();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:12,代码来源:ToggleButtonUI.java

示例4: paintButtonPressed

import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
protected void paintButtonPressed(Graphics g, AbstractButton c) {
    if (c.isContentAreaFilled()) {
        Graphics2D g2d = (Graphics2D) g;
        Dimension size = c.getSize();
        Composite oldComposite = g2d.getComposite();
        Color oldColor = g2d.getColor();
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f));
        g2d.setColor(Color.BLACK);
        g2d.fillRect(0, 0, size.width, size.height);
        g2d.setComposite(oldComposite);
        g2d.setColor(oldColor);

    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:16,代码来源:FreeColButtonUI.java

示例5: paint

import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {
	AbstractButton b = (AbstractButton) c;

	Dimension size = b.getSize();
	FontMetrics fm = g.getFontMetrics();

	Insets i = c.getInsets();

	Rectangle viewRect = new Rectangle(size);

	viewRect.x += i.left;
	viewRect.y += i.top;
	viewRect.width -= i.right + viewRect.x;
	viewRect.height -= i.bottom + viewRect.y;

	Rectangle iconRect = new Rectangle();
	Rectangle textRect = new Rectangle();

	Font f = c.getFont();
	g.setFont(f);

	String text = SwingUtilities.layoutCompoundLabel(c, fm, b.getText(), b.getIcon(), b.getVerticalAlignment(),
			b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, iconRect,
			textRect, b.getText() == null ? 0 : b.getIconTextGap());

	g.setColor(b.getBackground());

	if (b.isContentAreaFilled()) {
		if (RapidLookTools.isToolbarButton(b)) {
			RapidLookTools.drawToolbarButton(g, b);
		} else {
			RapidLookTools.drawButton(b, g, RapidLookTools.createShapeForButton(b));
		}
	}

	if (b.getIcon() != null) {
		paintIcon(g, b, iconRect);
	}

	if (text != null && !text.equals("")) {
		View v = (View) c.getClientProperty(BasicHTML.propertyKey);
		if (v != null) {
			v.paint(g, textRect);
		} else {
			paintText(g, b, textRect, text);
		}
	}

	if (b.isFocusPainted() && b.hasFocus()) {
		paintFocus(g, b, viewRect, textRect, iconRect);
	}

	if (!RapidLookTools.isToolbarButton(b)) {
		if (b.isBorderPainted()) {
			RapidLookTools.drawButtonBorder(b, g, RapidLookTools.createBorderShapeForButton(b));
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:60,代码来源:ToggleButtonUI.java


注:本文中的javax.swing.AbstractButton.isContentAreaFilled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。