Java Code Examples for javax.swing.AbstractButton#isFocusOwner()
The following examples show how to use
javax.swing.AbstractButton#isFocusOwner() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransparentToolBar.java From netbeans with Apache License 2.0 | 5 votes |
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(); }
Example 2
Source File: TransparentToolBar.java From visualvm with GNU General Public License v2.0 | 5 votes |
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(); }
Example 3
Source File: TransparentToolBar.java From visualvm with GNU General Public License v2.0 | 5 votes |
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(); }
Example 4
Source File: NavlinkUI.java From RipplePower with Apache License 2.0 | 5 votes |
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); } } }
Example 5
Source File: ButtonUI.java From RipplePower with Apache License 2.0 | 4 votes |
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); } } }
Example 6
Source File: ButtonState.java From pumpernickel with MIT License | 3 votes |
/** * * @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); }