2

Is there a way to make the JFileChooser show the directory string at the top of the dialog just like in Windows? I need it because in that way, the users can paste the value they want instead of traversing the hierarchy every time.

PS: I'd like to avoid custom FileChoosers if possible.

What I want:

enter image description here

What I have:

enter image description here

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Adel Boutros
  • 10,205
  • 7
  • 55
  • 89
  • 1
    [I think that still not possible for Win7/8](http://stackoverflow.com/questions/13471587/jfilechooser-is-not-opening-default-win-7-file-explorer), sorry too lazy test this issue in Java8, were decribed a few times could/will be fixed,(-: maybe in the summer :-) – mKorbel Feb 18 '13 at 14:07
  • 1
    Users can paste a directory into the "File Name" field and press enter to navigate to that directory. – VGR Feb 18 '13 at 14:30
  • @VGR That's a possible solution too! – Adel Boutros Feb 18 '13 at 14:46
  • 1- Your using metal look and feel, it's highly unlikely to be the default behaviour. 2- you'd need to implement your own look and feel – MadProgrammer Feb 18 '13 at 19:28
  • @MadProgrammer I don't have experience with Look & Feel, but I do use them, is it possible to have the ability to paste the value of the directory in the top box as in the Windows one? – Adel Boutros Feb 18 '13 at 20:36
  • @AdelBoutros With the current implementations, no, but I'm sure it would be possible to customise them to do so. Are you will to write a custom look and feel implementation for each look and feel you want to support? – MadProgrammer Feb 18 '13 at 22:18
  • @MadProgrammer I never said I was just aiming for Windows... Anyway, I believe the only solution is extending the file chooser to customize it. – Adel Boutros Feb 18 '13 at 23:05
  • @AdelBoutros I don't think extending `JFileChooser` is the best choice as it each Look & Feel changes, well, what it looks like. You will need to provide a Look and Feel implementation - IHMO – MadProgrammer Feb 18 '13 at 23:07
  • @MadProgrammer I found an answer :) – Adel Boutros Feb 19 '13 at 00:58

1 Answers1

0

The best solution would be to use the FileChooser from JavaFX. It has all the features needed to emulate the Windows file dialog.

http://docs.oracle.com/javafx/2/api/javafx/stage/FileChooser.html

Adel Boutros
  • 10,205
  • 7
  • 55
  • 89