Ejemplo n.º 1
0
 /** Shows a file dialog and opens a drawing. */
 public void promptOpen() {
   toolDone();
   JFileChooser openDialog = createOpenFileChooser();
   getStorageFormatManager().registerFileFilters(openDialog);
   if (openDialog.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
     StorageFormat foundFormat =
         getStorageFormatManager().findStorageFormat(openDialog.getFileFilter());
     if (foundFormat != null) {
       loadDrawing(foundFormat, openDialog.getSelectedFile().getAbsolutePath());
     } else {
       showStatus("Not a valid file format: " + openDialog.getFileFilter().getDescription());
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * Create a file chooser for the save file dialog. Subclasses may override this method in order to
  * customize the save file dialog.
  */
 protected JFileChooser createSaveFileChooser() {
   JFileChooser saveDialog = new JFileChooser();
   saveDialog.setDialogTitle("Save File...");
   return saveDialog;
 }
Ejemplo n.º 3
0
 /**
  * Create a file chooser for the open file dialog. Subclasses may override this method in order to
  * customize the open file dialog.
  */
 protected JFileChooser createOpenFileChooser() {
   JFileChooser openDialog = new JFileChooser();
   openDialog.setDialogTitle("Open File...");
   return openDialog;
 }