Hi,
Just found a alternative to fileChooser. It's called FileDialog.
Here is the Doc http://java.sun.com/j2se/1.4.2/docs/api/java/awt/FileDialog.html
And the example that helped me:
http://www.java-forums.org/java-tips/6330-example-file-dialog.html
I found this because I was getting frustrated not to be able to get the real os browser window when using JFileChooser. Even with the systemLookAndFeel. Has here you get the dialog box just like you set it in your os.
So here is the code, I haven't done much as the example is really good ( thanks to this moderator on java-forums). you can give a title to your dialog box window, select default directory to start with, the position of the box and the file type. And it's really easy to use.
Quote:import java.awt.*;
import java.awt.event.*;
import java.io.*;
void setup(){
size(400, 400);
}
void draw(){
}
void keyReleased(){
if(key == 'o') println( loadFile(new Frame(), "open your favorite file", "/Users/myName/Desktop/", "") );
if(key == 's') println( saveFile(new Frame(), "save your great work", "", "") );
}
String loadFile (Frame f, String title, String defDir, String fileType) {
FileDialog fd = new FileDialog(f, title, FileDialog.LOAD);
fd.setFile(fileType);
fd.setDirectory(defDir);
fd.setLocation(50, 50);
fd.show();
String path = fd.getDirectory()+fd.getFile();
return path;
}
String saveFile (Frame f, String title, String defDir, String fileType) {
FileDialog fd = new FileDialog(f, title, FileDialog.SAVE);
fd.setFile(fileType);
fd.setDirectory(defDir);
fd.setLocation(50, 50);
fd.show();
String path = fd.getDirectory()+fd.getFile();
return path;
}