Dies ist eine alte Version des Dokuments!


Java - AWT/Swing

JFileChooser/Datei öffnen Dialog (Open file)



JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setMultisSelctionEnabled(false);
fc.setCurrentDirectory(System.getProperty("user.home"));
if (fc.showDialog(this, "Datei öffnen") == JFileChooser.APPROVE_OPTIONS) {
   System.out.println(fc.getSelectedFile().getAbsoluteFile());
}

Eigene Werkzeuge
Werkzeuge

gratis Counter by GOWEB
seit 9.10.2007