@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"));
  }
 @Override
 public Dimension getMinimumSize(JComponent c) {
   AbstractButton b = (AbstractButton) c;
   String style = (String) c.getClientProperty("Quaqua.Button.style");
   if (style == null) {
     style = "push";
   }
   if (style.equals("help")) {
     return getPreferredSize(c);
   }
   Dimension d = super.getMinimumSize(c);
   if (isFixedHeight(c)) {
     Dimension p = getPreferredSize(c);
     if (d != null && p != null) {
       d.height = Math.max(d.height, p.height);
     }
   }
   if (!QuaquaUtilities.isSmallSizeVariant(c)
       && style.equals("push") //
       && b.getIcon() == null
       && b.getText() != null) {
     if (d != null) {
       d.width = Math.max(d.width, UIManager.getInt("Button.minimumWidth"));
     }
   }
   return d;
 }
  /**
   * Method which renders the text of the current button.
   *
   * <p>
   *
   * @param g Graphics context
   * @param b Current button to render
   * @param textRect Bounding rectangle to render the text.
   * @param text String to render
   * @since 1.4
   */
  @Override
  protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) {
    ButtonModel model = b.getModel();
    FontMetrics fm = g.getFontMetrics();
    int mnemonicIndex = Methods.invokeGetter(b, "getDisplayedMnemonicIndex", -1);
    boolean borderHasPressedCue = borderHasPressedCue(b);

    /* Draw the Text */
    if (model.isPressed() && model.isArmed() && !borderHasPressedCue) {
      g.setColor(new Color(0xa0000000, true));
      QuaquaUtilities.drawStringUnderlineCharAt(
          g,
          text,
          mnemonicIndex,
          textRect.x + getTextShiftOffset(),
          textRect.y + fm.getAscent() + getTextShiftOffset() + 1);
    }

    if (model.isEnabled()) {
      /** * paint the text normally */
      g.setColor(b.getForeground());
    } else {
      Color c = UIManager.getColor(getPropertyPrefix() + "disabledForeground");
      g.setColor((c != null) ? c : b.getForeground());
    }
    QuaquaUtilities.drawStringUnderlineCharAt(
        g,
        text,
        mnemonicIndex,
        textRect.x + getTextShiftOffset(),
        textRect.y + fm.getAscent() + getTextShiftOffset());
  }
  @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);
  }
  // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    fc = new javax.swing.JPanel();
    fromPanel = new javax.swing.JPanel();
    fileNameLabel = new javax.swing.JLabel();
    fileNameTextField = new javax.swing.JTextField();
    strutPanel1 = new javax.swing.JPanel();
    lookInLabel = new javax.swing.JLabel();
    directoryComboBox = new javax.swing.JComboBox();
    strutPanel2 = new javax.swing.JPanel();
    separatorPanel1 = new javax.swing.JPanel();
    separatorPanel2 = new javax.swing.JPanel();
    browserScrollPane = new javax.swing.JScrollPane();
    browser = new ch.randelshofer.quaqua.JBrowser();
    newFolderButton = new javax.swing.JButton();
    separatorPanel = new javax.swing.JPanel();
    formatPanel = new javax.swing.JPanel();
    formatPanel2 = new javax.swing.JPanel();
    filesOfTypeLabel = new javax.swing.JLabel();
    filterComboBox = new javax.swing.JComboBox();
    accessoryPanel = new javax.swing.JPanel();
    buttonPanel = new javax.swing.JPanel();
    cancelButton = new javax.swing.JButton();
    approveButton = new javax.swing.JButton();

    setLayout(new java.awt.BorderLayout());

    fc.setLayout(new java.awt.GridBagLayout());

    fromPanel.setLayout(new java.awt.GridBagLayout());

    fileNameLabel.setText(UIManager.getString("FileChooser.fileNameLabelText"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 14, 0);
    fromPanel.add(fileNameLabel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 14, 0);
    fromPanel.add(fileNameTextField, gridBagConstraints);

    strutPanel1.setLayout(null);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.ipadx = 40;
    gridBagConstraints.ipady = 5;
    fromPanel.add(strutPanel1, gridBagConstraints);

    lookInLabel.setText(UIManager.getString("FileChooser.fromLabelText"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 1, 0, 0);
    fromPanel.add(lookInLabel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 0);
    fromPanel.add(directoryComboBox, gridBagConstraints);

    strutPanel2.setLayout(new java.awt.BorderLayout());

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.ipadx = 40;
    gridBagConstraints.ipady = 5;
    fromPanel.add(strutPanel2, gridBagConstraints);

    separatorPanel1.setLayout(new java.awt.BorderLayout());

    separatorPanel1.setBackground(
        javax.swing.UIManager.getDefaults().getColor("Separator.foreground"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipadx = 40;
    gridBagConstraints.ipady = 1;
    gridBagConstraints.weightx = 1.0E-4;
    fromPanel.add(separatorPanel1, gridBagConstraints);

    separatorPanel2.setLayout(new java.awt.BorderLayout());

    separatorPanel2.setBackground(
        javax.swing.UIManager.getDefaults().getColor("Separator.foreground"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.ipadx = 40;
    gridBagConstraints.ipady = 1;
    fromPanel.add(separatorPanel2, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(14, 0, 0, 0);
    fc.add(fromPanel, gridBagConstraints);

    browserScrollPane.setHorizontalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    browserScrollPane.setVerticalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    browserScrollPane.setViewportView(browser);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(8, 23, 0, 23);
    fc.add(browserScrollPane, gridBagConstraints);

    newFolderButton.setText(UIManager.getString("FileChooser.newFolderButtonText"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
    fc.add(newFolderButton, gridBagConstraints);

    separatorPanel.setLayout(new java.awt.BorderLayout());

    separatorPanel.setBackground(
        javax.swing.UIManager.getDefaults().getColor("Separator.foreground"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipady = 1;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(14, 0, 0, 0);
    fc.add(separatorPanel, gridBagConstraints);

    formatPanel.setLayout(new java.awt.GridBagLayout());

    formatPanel2.setLayout(new java.awt.BorderLayout(2, 0));

    filesOfTypeLabel.setText(UIManager.getString("FileChooser.filesOfTypeLabelText"));
    formatPanel2.add(filesOfTypeLabel, java.awt.BorderLayout.WEST);

    formatPanel2.add(filterComboBox, java.awt.BorderLayout.CENTER);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 40, 0, 40);
    formatPanel.add(formatPanel2, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(14, 0, 0, 0);
    fc.add(formatPanel, gridBagConstraints);

    accessoryPanel.setLayout(new java.awt.BorderLayout());

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(14, 20, 0, 20);
    fc.add(accessoryPanel, gridBagConstraints);

    buttonPanel.setLayout(new java.awt.GridBagLayout());

    cancelButton.setText(UIManager.getString("FileChooser.cancelButtonText"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 18, 16, 0);
    buttonPanel.add(cancelButton, gridBagConstraints);

    approveButton.setText(UIManager.getString("FileChooser.openButtonText"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 6, 16, 22);
    buttonPanel.add(approveButton, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridy = 6;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(14, 0, 0, 0);
    fc.add(buttonPanel, gridBagConstraints);

    add(fc, java.awt.BorderLayout.CENTER);
  } // </editor-fold>//GEN-END:initComponents
  public static Dimension getPreferredSize(AbstractButton b) {
    String style = (String) b.getClientProperty("Quaqua.Button.style");
    if (style == null) {
      style = "push";
    }
    if (style.equals("help")) {
      Icon helpIcon = UIManager.getIcon("Button.helpIcon");
      Insets insets = b.getInsets();

      return new Dimension(
          helpIcon.getIconWidth() + insets.left + insets.right,
          helpIcon.getIconHeight() + insets.top + insets.bottom);
    }
    if (b.getComponentCount() > 0) {
      return null;
    }

    int textIconGap = Methods.invokeGetter(b, "getIconTextGap", 4);
    Icon icon = (Icon) b.getIcon();
    String text = b.getText();

    Font font = b.getFont();
    FontMetrics fm = b.getFontMetrics(font);

    viewR.x = viewR.y = 0;
    viewR.width = Short.MAX_VALUE;
    viewR.height = Short.MAX_VALUE;
    iconR.x = iconR.y = iconR.width = iconR.height = 0;
    textR.x = textR.y = textR.width = textR.height = 0;

    SwingUtilities.layoutCompoundLabel(
        (JComponent) b,
        fm,
        text,
        icon,
        b.getVerticalAlignment(),
        b.getHorizontalAlignment(),
        b.getVerticalTextPosition(),
        b.getHorizontalTextPosition(),
        viewR,
        iconR,
        textR,
        (text == null ? 0 : textIconGap));

    /* The preferred size of the button is the size of
     * the text and icon rectangles plus the buttons insets.
     */

    Rectangle r = iconR.union(textR);

    // if (b.isBorderPainted()) {
    Insets insets = b.getInsets();
    r.width += insets.left + insets.right;
    r.height += insets.top + insets.bottom;
    // }
    if (!QuaquaUtilities.isSmallSizeVariant(b)
        && style.equals("push")
        && b.getIcon() == null
        && b.getText() != null) {
      r.width = Math.max(r.width, UIManager.getInt("Button.minimumWidth"));
    }
    return r.getSize();
  }