@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"));
  }
Example #2
0
 public static AbstractButton makeToolBarButton(Command cmd) {
   AbstractButton b;
   if (cmd instanceof ToggleCommand) {
     b = new JToggleButton(cmd);
     b.setSelected(((ToggleCommand) cmd).isSelected());
   } else {
     b = new JButton(cmd);
   }
   b.setFocusable(false);
   b.setText(null);
   // b.setMargin(new Insets(2, 2, 2, 2));
   b.setBorderPainted(false);
   cmd.bind(b);
   return b;
 }
Example #3
0
  @Override
  public void installUI(JComponent c) {
    AbstractButton button = (AbstractButton) c;

    ButtonInfo info = new ButtonInfo(button, this);
    button.putClientProperty(BUTTON_INFO_KEY, info);

    button.addMouseListener(info.basicListener);
    button.addMouseMotionListener(info.basicListener);
    button.addFocusListener(info.basicListener);
    button.addPropertyChangeListener(info.basicListener);
    button.addChangeListener(info.basicListener);
    button.addKeyListener(focusArrowListener);
    button.addComponentListener(componentListener);
    button.addKeyListener(keyArmingListener);
    button.setRequestFocusEnabled(false);
    button.setFocusable(true);
    button.addPropertyChangeListener(positionAndShapeListener);
    button.setOpaque(false);
    button.setRolloverEnabled(true);

    if (button.getIcon() != null) {
      Font font = UIManager.getFont("IconButton.font");
      if (font != null) button.setFont(font); // miniature-ish
    }

    super.installUI(c);

    updateLayout(button, info);

    if (button.getFont() == null) {
      Font font = UIManager.getFont("Button.font");
      if (font == null) {
        font = new Font("Default", 0, 13);
      }
      button.setFont(font);
    }
  }