public synchronized void saveProperties() { if (ownLock()) { try { FileOutputStream out = new FileOutputStream(propertyFile); try { fontProps.store(out, "-- ICEpf Font properties --"); } finally { out.close(); } recordMofifTime(); } catch (IOException ex) { // check to make sure the storage relate dialogs can be shown if (getBoolean("application.showLocalStorageDialogs", true)) { Resources.showMessageDialog( null, JOptionPane.ERROR_MESSAGE, messageBundle, "fontManager.properties.title", "manager.properties.saveError", ex); } // log the error if (logger.isLoggable(Level.WARNING)) { logger.log(Level.WARNING, "Error saving font properties cache", ex); } } } }
public void save(ActionEvent e) { if (file == null) { saveAs(e); } try { OutputStream out = new BufferedOutputStream(new FileOutputStream(file)); wordList.store(out, "Generated by JWordPlay"); out.flush(); out.close(); } catch (IOException ex) { handleException(ex); } }
private void speichern(Path saveName) { Properties prop = new Properties(); if (!quellListModel.isEmpty()) for (int i = 0; i < quellListModel.getSize(); i++) prop.setProperty( String.format("quellMenu%d", i), quellListModel.getElementAt(i).getValueMember().toString()); if (!zielListModel.isEmpty()) for (int i = 0; i < zielListModel.getSize(); i++) prop.setProperty( String.format("zielMenu%d", i), zielListModel.getElementAt(i).getValueMember().toString()); try { FileOutputStream out = new FileOutputStream(saveName.toString()); prop.store(out, null); out.close(); } catch (Exception e) { e.printStackTrace(); } }