protected void fileSave() { if (currentFile == null) { fileSaveAs(); } else { if (currentFile.isDirectory()) { fileSaveAs(); } else { graph.saveAll(currentFile); gp.update(gp.getGraphics()); } } }
protected void fileSaveAs() { JFileChooser chooser = null; if (currentFile == null) { chooser = new JFileChooser(startDirectory); } else { chooser = new JFileChooser(currentFile); if (!currentFile.isDirectory()) { chooser.setSelectedFile(currentFile); } } int returnVal = chooser.showSaveDialog(gw); if (returnVal == JFileChooser.APPROVE_OPTION) { currentFile = chooser.getSelectedFile(); graph.saveAll(currentFile); } }