0

I want to create a directory selector in Java, but when doing this using the JFileChooser and set it to DIRECTORIES-ONLY, you get an unclear layout of the folders (just a normal FileChooser layout). For folders however I think its more useful to show a filetree showing all directories with the main disk as root, like a normal windows filechooser (see this post, this guy wants to do the same thing but not in Java).

Is there some way to do this without writing it myself (preferably not with external libraries)?

Community
  • 1
  • 1
cvbattum
  • 811
  • 2
  • 15
  • 32
  • You can try extending the existing code, if the class isn't marked `final`. The you can overwrite the drawing methods to draw whatever you want/need. Otherwise, you have to roll-your-own. – CodeChimp Feb 05 '14 at 21:03
  • So are you saying that it is not possible without writing alot of code myself? – cvbattum Feb 05 '14 at 21:08
  • I am saying I do not believe it's possible to customize the JFileChooser without doing some code. How much depends on if you can simply extend the existing class and modify how it's drawing. – CodeChimp Feb 06 '14 at 12:35
  • BTW, this posting on SO might be of some use: http://stackoverflow.com/questions/6720957/creating-custom-jfilechooser – CodeChimp Feb 06 '14 at 12:41

0 Answers0