Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JFileChooser on OS X

JFileChooser looks nothing like the native widget. I seem to remember reading some hack to get it look like the native widget but searching for it know i can't seem to find it again i came across posts that suggest using java.awt.FileChooser but that class does not seem to be in the distribution. How can i make JFileChooser make look like the native widget?

like image 203
Hamza Yerlikaya Avatar asked Jun 02 '09 01:06

Hamza Yerlikaya


People also ask

What is a JFileChooser?

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 .

What are the commonly used constructors of JFileChooser?

Commonly used Constructors: Constructs a JFileChooser pointing to the user's default directory. Constructs a JFileChooser using the given File as the path. Constructs a JFileChooser using the given path.


2 Answers

Take a look at this page. It goes through a lot of UI tweaks, but the third one is most relevant: "Using the JFileChooser to get Mac file and folder icons."

like image 95
Tim Avatar answered Oct 03 '22 15:10

Tim


java.awt.FileDialog will be the classes the posts meant. It is, unsurprisingly, more limited that the Swing version. All Java SE implementations are required to have the FileDialog class (although headless configurations may not be able to do anything useful with it).

like image 45
Tom Hawtin - tackline Avatar answered Oct 03 '22 13:10

Tom Hawtin - tackline