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

[macosx] JFileChooser is silently not shown if wrong string is passed to constructor

XMLWordPrintable

      JFileChooser silently not shown if wrong string is passed to constructor

      Good on Windows. (if "." - curdir is shown. if "some junk" - home user dir)

      Bad on OS X. JFrame is not shown at all! No exception is thrown!

      Found with help of test Swing_DnD/Automated/JFChooser2JTADnDTest

      Run this code on OS X:

      import java.awt.AWTException;
      import java.awt.BorderLayout;
      import javax.swing.CellRendererPane;
      import javax.swing.JButton;
      import javax.swing.JComponent;
      import javax.swing.JFileChooser;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.UIManager;
      import javax.swing.UnsupportedLookAndFeelException;

      /**
       *
       * @author ampopov
       */
      public class NewClass {

          static CellRendererPane crp;
          static JComponent c45;

          public static void main(String[] args) throws AWTException, InterruptedException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
              UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              JFrame f = new JFrame();

              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JFileChooser jfc = new JFileChooser(".");
              jfc.setDragEnabled(true);
              JPanel p = new JPanel();
              p.add(jfc);
              f.add(p, BorderLayout.NORTH);
              f.add(new JButton("dffd"));
              f.pack();
              f.setVisible(true);
              
          }
      }

            Unassigned Unassigned
            ampopov Alexander Popov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: