下面列出了javax.swing.AbstractButton#isFocusOwner ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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();
}
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();
}
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();
}
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);
}
}
}
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);
}
}
}
/**
*
* @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);
}