How to use the default File Chooser for the operating system? java
I was just wondering: how does Gmail use the Windows/Mac file chooser to upload files? Is there any way to do this in Java?
Personally, I don't like the way that the JFileChooser
looks like, and I thought it would be better for my users to be able to use something that they're more used to. Tips anyone?
Solution 1:
Use the old java.awt.FileDialog instead:
new java.awt.FileDialog((java.awt.Frame) null).setVisible(true);
Solution 2:
You can try using JFileChooser but setting the look and feel to be the platform look and feel:
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}catch(Exception ex) {
ex.printStackTrace();
}
And that would make all the swing components look nicer!