@Override
  protected void installDefaults(AbstractButton b) {
    super.installDefaults(b);

    String pp = getPropertyPrefix();
    // b.setOpaque(QuaquaManager.getBoolean(pp+"opaque"));
    QuaquaUtilities.installProperty(b, "opaque", UIManager.get(pp + "opaque"));
    b.setRequestFocusEnabled(UIManager.getBoolean(pp + "requestFocusEnabled"));
    b.setFocusable(UIManager.getBoolean(pp + "focusable"));
  }
예제 #2
0
 /**
  * If necessary paints the background of the component, then invokes <code>paint</code>.
  *
  * @param g Graphics to paint to
  * @param c JComponent painting on
  * @throws NullPointerException if <code>g</code> or <code>c</code> is null
  * @see javax.swing.plaf.ComponentUI#update
  * @see javax.swing.plaf.ComponentUI#paint
  * @since 1.5
  */
 public void update(Graphics g, JComponent c) {
   AbstractButton button = (AbstractButton) c;
   if ((c.getBackground() instanceof UIResource)
       && button.isContentAreaFilled()
       && c.isEnabled()) {
     ButtonModel model = button.getModel();
     if (!MetalUtils.isToolBarButton(c)) {
       if (!model.isArmed()
           && !model.isPressed()
           && MetalUtils.drawGradient(
               c, g, "Button.gradient", 0, 0, c.getWidth(), c.getHeight(), true)) {
         paint(g, c);
         return;
       }
     } else if (model.isRollover()
         && MetalUtils.drawGradient(
             c, g, "Button.gradient", 0, 0, c.getWidth(), c.getHeight(), true)) {
       paint(g, c);
       return;
     }
   }
   super.update(g, c);
 }
  @Override
  public void paint(Graphics g, JComponent c) {

    String style = (String) c.getClientProperty("Quaqua.Button.style");
    if (style != null && style.equals("help")) {
      Insets insets = c.getInsets();
      UIManager.getIcon("Button.helpIcon").paintIcon(c, g, insets.left, insets.top);
      return;
    }

    Object oldHints = QuaquaUtilities.beginGraphics((Graphics2D) g);
    if (((AbstractButton) c).isBorderPainted()) {
      Border b = c.getBorder();
      if (b != null && b instanceof BackgroundBorder) {
        ((BackgroundBorder) b)
            .getBackgroundBorder()
            .paintBorder(c, g, 0, 0, c.getWidth(), c.getHeight());
      }
    }
    super.paint(g, c);
    QuaquaUtilities.endGraphics((Graphics2D) g, oldHints);
    Debug.paint(g, c, this);
  }
예제 #4
0
 public void uninstallDefaults(AbstractButton b) {
   super.uninstallDefaults(b);
 }