/**
 * 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

Ph.D. on Applied Mathematics in Aug 2007. Involved on applications of image super-resolution to electron microscopy

Francisco Blanco-Silva