/**
 * Display file open dialog easily.
 */
public static java.io.File guiOpenFile(java.awt.Component caller, String homeDirectory) {
	javax.swing.JFileChooser fc = new javax.swing.JFileChooser();
	fc.setSelectedFile(new java.io.File(homeDirectory));
	int returnVal = fc.showOpenDialog(caller);
	if (returnVal == javax.swing.JFileChooser.APPROVE_OPTION) {
		return fc.getSelectedFile();
	} else {
		return null;
	}
}
 
public static java.io.File guiOpenFile(java.awt.Component caller) {
	return Ts.guiOpenFile(caller, ".");
}


Back to JavaHowTo

Alumni Liaison

To all math majors: "Mathematics is a wonderfully rich subject."

Dr. Paul Garrett