Alternative to JFileChooser on Linux?
Asked Answered
B

2

10

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?

Beige answered 11/4, 2010 at 16:36 Comment(2)
possible duplicate of https://mcmap.net/q/676986/-alternative-to-jfilechooserFitch
Not really duplicate as explained in Yuvi Masory's answer.Chidester
C
3

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.

Conjuncture answered 13/4, 2010 at 0:56 Comment(2)
Thanks! I think I'm going to use the VFSJFileChooser in futur! ThanksBeige
I have just developed OtrosVfsBrowser (code.google.com/p/otrosvfsbrowser). I have done this to migrate from VFSJFileChooser in OtrosLogViewer. OtrosVfsBrowser reads VFSJFileChooser bookmarks.Nenitanenney
D
1

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.

Dilisio answered 4/1, 2014 at 19:33 Comment(1)
Unfortunately, there seems to be no way to get filtering by extension working in FileDialog in a platform independent manner.Resource

© 2022 - 2024 — McMap. All rights reserved.