Пример #1
0
 /** Load a Drawing from a file */
 protected void loadDrawing(StorageFormat restoreFormat, String file) {
   try {
     Drawing restoredDrawing = restoreFormat.restore(file);
     if (restoredDrawing != null) {
       restoredDrawing.setTitle(file);
       newWindow(restoredDrawing);
     } else {
       showStatus("Unknown file type: could not open file '" + file + "'");
     }
   } catch (IOException e) {
     showStatus("Error: " + e);
   }
 }
Пример #2
0
 /** Save a Drawing in a file */
 protected void saveDrawing(StorageFormat storeFormat, String file) {
   // Need a better alert than this.
   if (view() == null) {
     return;
   }
   try {
     String name = storeFormat.store(file, view().drawing());
     view().drawing().setTitle(name);
     setDrawingTitle(name);
   } catch (IOException e) {
     showStatus(e.toString());
   }
 }