1 19 package com.zanthan.sequence; 20 21 import java.io.File ; 22 23 import javax.swing.JFileChooser ; 24 25 public class SaveAsAction 27 extends ModelAction { 28 29 SaveAsAction(Model model) { 30 super("SaveAsAction", model); 31 } 32 33 boolean doIt() { 34 final JFileChooser chooser = new JFileChooser (); 35 chooser.setDialogType(JFileChooser.SAVE_DIALOG); 36 chooser.setDialogTitle(getResource("dialogTitle")); 37 38 int returnVal = chooser.showSaveDialog(Sequence.getInstance()); 39 if (returnVal == JFileChooser.APPROVE_OPTION) { 40 File file = chooser.getSelectedFile(); 41 return getModel().writeToFile(file); 42 } else { 43 return false; 44 } 45 } 46 } 47 | Popular Tags |