public void saveToFile() { fc.setDialogTitle(Messages.getString("GameInformationFrame.SAVE_TITLE")); // $NON-NLS-1$ if (fc.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) return; String name = fc.getSelectedFile().getPath(); if (CustomFileFilter.getExtension(name) == null) name += ".rtf"; // $NON-NLS-1$ try { FileOutputStream i = new FileOutputStream(new File(name)); rtf.write(i, editor.getDocument(), 0, 0); i.close(); } catch (Exception e) { e.printStackTrace(); } }
public void saveToFile() { commitChanges(); fc.setDialogTitle(Messages.getString("EnigmaSettingsFrame.SAVE_TITLE")); // $NON-NLS-1$ if (fc.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) return; String name = fc.getSelectedFile().getPath(); if (CustomFileFilter.getExtension(name) == null) name += ".ey"; // $NON-NLS-1$ try { PrintWriter pw = new PrintWriter(new File(name)); res.toYaml(pw, true); pw.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } }