Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8300084

AquaFileChooserUI.getDefaultButton returns null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 8, 11, 17, 20, 21
    • client-libs
    • None
    • b06
    • os_x

      FileChooserUI.getDefaultButton returns non-null value for every Look and Feel but Aqua.

      The default implementation in javax.swing.plaf.FileChooserUI#getDefaultButton returns null. It's overridden in BasicFileChooserUI to return getApproveButton which, in its turn, returns the Approve button in each Look and Feel.

      AquaFileChooserUI does not extend BasicFileChooserUI, therefore the returned value remains null.

      ---------- BEGIN SOURCE ----------
      import javax.swing.JFileChooser;
      import javax.swing.SwingUtilities;

      public class FileChooserDefaultButton {
          public static void main(String[] args) throws Exception {
              SwingUtilities.invokeAndWait(() -> {
                  JFileChooser fc = new JFileChooser();
                  System.out.println(fc.getUI().getDefaultButton(fc));
              });
          }
      }
      ---------- END SOURCE ----------

            tr Tejesh R
            aivanov Alexey Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: