javax.swing.AbstractButton#isFocusOwner ( )源码实例Demo

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

源代码1 项目: netbeans   文件: TransparentToolBar.java
private void refresh(final AbstractButton b) {
    b.setBackground(UIUtils.getProfilerResultsBackground());
    boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
    boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
    b.setOpaque(filled);
    b.setContentAreaFilled(filled);
    b.repaint();
}
 
源代码2 项目: visualvm   文件: TransparentToolBar.java
private void refresh(final AbstractButton b) {
    b.setBackground(UIUtils.getProfilerResultsBackground());
    boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
    boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
    b.setOpaque(filled);
    b.setContentAreaFilled(filled);
    b.repaint();
}
 
源代码3 项目: visualvm   文件: TransparentToolBar.java
private void refresh(final AbstractButton b) {
    b.setBackground(UISupport.getDefaultBackground());
    boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
    boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
    b.setOpaque(filled);
    b.setContentAreaFilled(filled);
    b.repaint();
}
 
源代码4 项目: RipplePower   文件: NavlinkUI.java
public void paint(Graphics g, JComponent c) {
	AbstractButton b = (AbstractButton) c;
	ButtonModel model = b.getModel();

	String text = layout(b, g.getFontMetrics(), b.getWidth(), b.getHeight());

	clearTextShiftOffset();

	if (model.isArmed() && model.isPressed()) {
		paintButtonPressed(g, b);
	} else if (b.isRolloverEnabled() && model.isRollover()) {
		paintButtonPressed(g, b);
	}

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

	if (b.isFocusPainted() && b.isFocusOwner()) {
		paintFocus(g, b, viewRect, textRect, iconRect);
		if (iconRect != null && iconRect.width > 0 && iconRect.height > 0) {
			if (b.getIcon() != null) {
				paintIcon(g, c, iconRect);
			}
		}
	}

	if (text != null && !text.equals("")) {
		Graphics2D g2 = (Graphics2D) g.create();
		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);

		View v = (View) c.getClientProperty(BasicHTML.propertyKey);
		if (v != null) {
			v.paint(g2, textRect);
		} else {
			paintText(g2, b, textRect, text);
		}
	}
}
 
源代码5 项目: RipplePower   文件: ButtonUI.java
public void paint(Graphics g, JComponent c) {
	AbstractButton b = (AbstractButton) c;
	ButtonModel model = b.getModel();

	String text = layout(b, g.getFontMetrics(), b.getWidth(), b.getHeight());

	clearTextShiftOffset();

	if (!model.isArmed() && !model.isPressed()) {
		paintButtonBackground(g, b);
	}

	if (model.isArmed() && model.isPressed()) {
		paintButtonPressed(g, b);
	} else if (b.isRolloverEnabled() && model.isRollover()) {
		paintButtonPressed(g, b);
	}

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

	if (b.isFocusPainted() && b.isFocusOwner()) {
		paintFocus(g, b, viewRect, textRect, iconRect);
		if (iconRect != null && iconRect.width > 0 && iconRect.height > 0) {
			if (b.getIcon() != null) {
				paintIcon(g, c, iconRect);
			}
		}
	}

	if (text != null && !text.equals("")) {
		Graphics2D g2 = (Graphics2D) g.create();
		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);

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

}
 
源代码6 项目: pumpernickel   文件: ButtonState.java
/**
 * 
 * @param button
 * @param properties
 *            an optional set of properties that can be identified by
 *            calling {@link #getProperties()}.
 */
public ButtonState(AbstractButton button, Property... properties) {
	this(button.getModel().isArmed(), button.getModel().isEnabled(), button
			.isFocusOwner(), button.getModel().isPressed(), button
			.getModel().isRollover(), button.getModel().isSelected(),
			properties);
}