I want to open a folder when i click a button ..

What is the command for that??

plz help...

(thing is i jst don't wanna complex thing like file chooser ..jst want to open a paticular folder given by a path.)

8 Years
Discussion Span
Last Post by masijade

An actionListener that opens a JDialog, but you'll have to create your own "view".

I didn't really understood what you hv said!!!

I found something like this....(And it WORKED!!!:))

String a="C:\\";

Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL \""+a+"\"");

I feel theres smthing wrong there!!!!! But it worked...

Edited by jrosh: n/a


That is definately not what you want. Look at the File class, it's listFiles() method, design an icon for each "filetype", add an actionlistener to this "button", and with that actionlistener, open a JDialog. On that JDialog place the icons.

There is not a "one-click" solution to this, unless you use JFileChooser. That is the only "folder displayer" in the Swing arsenal that I am aware of. Any other view you will have to do yourself.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.