JFileChooser fileChooser = new JFileChooser() { @Override public void approveSelection() { File file = getSelectedFile(); if (file.exists()) { if (JOptionPane.showConfirmDialog(this, file.getName() + " ist bereits vorhanden." + System.getProperty("line.separator") + "Möchten Sie sie ersetzen?", "Speichern bestätigen", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) super.approveSelection(); } else super.approveSelection(); } }; if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) //speichern |