-
Bug
-
Resolution: Not an Issue
-
P5
-
7u10, 8, 9
-
os_x
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);
}
}
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);
}
}
- relates to
-
JDK-8058496 [macosx] DnD does not work for JFileChooser on OS X
- Closed