Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative to JFileChooser on Linux?

I don't like this ugly FileChooser layout in Linux.

enter image description here

This layout is used by any other program and is MUCH more beautiful.

Screenshot

Is this layout available in Java? If so, how?

like image 604
Martijn Courteaux Avatar asked Apr 11 '10 16:04

Martijn Courteaux


2 Answers

Update: this project is dedicated to solving the problem.

I do not believe this is a duplicate. The suggested solutions in the other questions do not help the situation in Linux (GTK at least).

  • AWT's FileDialog looks different than JFileChooser, but really just as strange. It does not look like the file choosers of native GTK applications.
  • XFileDialog is Windows-only and falls back on JFileChooser in GTK.
  • VFSJFileChooser does not have improved GTK LAF as a goal.

Unfortunately I do not know of any file chooser that looks native in GTK. Hopefully someone else does.

like image 78
Yuvi Masory Avatar answered Oct 10 '22 15:10

Yuvi Masory


The gtkjfilechooser is not working with newer JDK's like JDK7. This was reported 2011, but is not fixed yet.

On the other side, the AWT FileDialog has been improved with Java 7 - including multiple file selection. Check linked JavaDoc for .

AWT's FileDialog looks different than JFileChooser, but really just as strange. It does not look like the file choosers of native GTK applications.

Talking about FileDialog of JDK7, this is not true anymore. Now, it looks exactly like the native one.


Btw., the same issue occurs on OS X, the it's JFileChooser doesn't look very native too. Apple recommends the usage of FileDialog instead of JFileChooser:

Although each has its advantages, java.awt.FileDialog makes your applications behave more like a native Mac app. This dialog [FileDialog], [...], looks much like a Finder window in OS X.

[...]

The Swing dialog, [...], looks much less like an OS X dialog.

[...]

Unless you need a functional advantage of JFileChooser, use FileDialog instead.

(Source)

Last sentence seems to be common (for all *NIX?) between Linux and OS X. So finally:

If you don't have a (functional) reason for JFileChooser, use AWT's FileDialog instead.

like image 44
ollo Avatar answered Oct 10 '22 14:10

ollo