Question

I was wondering if there is a GUI file explorer package in java to save me some time.

I'm talking about anything like the window you would see when "Browsing" a file in windows for loading into a media player for example.

Something like this:

enter image description here

Please I am asking if a specific package or methods exist to accommodate this. Just saying Jframe and swing is not really what I am looking for.

Was it helpful?

Solution

You are looking for http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html

    JFileChooser chooser = new JFileChooser();
    int option = chooser.showOpenDialog(SimpleFileChooser.this);
    if (option == JFileChooser.APPROVE_OPTION) {
      statusbar.setText("You opened " + ((chooser.getSelectedFile()!=null) ? chooser.getSelectedFile().getName():"nothing"));
    }
    else {
      statusbar.setText("You canceled.");
    }

OTHER TIPS

I searched in Google for something like this however I must not have phrased it correctly.

We have java.awt.FileDialog that uses the native file system explorer(more user friendly) and like fvu said JFileChooser. A tutorial for http://www.tutorialspoint.com/awt/awt_filedialog.htm here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top