Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

enter image description here

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?

like image 596
mattbdean Avatar asked May 24 '12 20:05

mattbdean


People also ask

What is file chooser in Java?

JFileChooser is a part of java Swing package. The java Swing package is part of JavaTM Foundation Classes(JFC) . JFC contains many features that help in building graphical user interface in java . Java Swing provides components such as buttons, panels, dialogs, etc .

How do I find my JFileChooser file name?

JFileChooser fc = new JFileChooser(); int returnVal = fc. showSaveDialog(frame); if (returnVal == JFileChooser. APPROVE_OPTION){ File file = fc. getSelectedFile(); if (file.


1 Answers

Use the old java.awt.FileDialog instead:

new java.awt.FileDialog((java.awt.Frame) null).setVisible(true);
like image 131
Mattias Isegran Bergander Avatar answered Sep 17 '22 00:09

Mattias Isegran Bergander