示例#1
0
 public void save(String filename) {
   try {
     File propFile = new File(NdEditFormulas.getSupportPath(), filename);
     FileOutputStream f = new FileOutputStream(propFile);
     internalToProperties().save(f, "ndEdit User Settings");
   } catch (Exception e) {
     String errmsg = new String("Cannot open FileOutputStream: " + filename);
     JOptionPane.showMessageDialog(null, errmsg, "ERROR", JOptionPane.ERROR_MESSAGE);
   }
 }
示例#2
0
 public void load(String filename) {
   FileInputStream f;
   try {
     File propFile = new File(NdEditFormulas.getSupportPath(), filename);
     f = new FileInputStream(propFile);
   } catch (Exception e) {
     System.out.println("Exception: " + e.toString());
     String errmsg = new String("Cannot open input stream (or load properties): " + filename);
     JOptionPane.showMessageDialog(null, errmsg, "ERROR", JOptionPane.ERROR_MESSAGE);
     return;
   }
   Properties props = new Properties();
   try {
     props.load(f);
   } catch (Exception e) {
     System.out.println("Exception: " + e.toString());
     String errmsg = new String("Cannot or load properties from file: " + filename);
     JOptionPane.showMessageDialog(null, errmsg, "ERROR", JOptionPane.ERROR_MESSAGE);
     return;
   }
   propertiesToInternal(props);
 }