Package javax.swing

Examples of javax.swing.JFileChooser.showSaveDialog()


    saveButton.setMnemonic('S');
    saveButton.setToolTipText("Saves the output to a file");
    saveButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent evt){
        JFileChooser filechooser = new JFileChooser();
        int result = filechooser.showSaveDialog(dialog);
        if (result == JFileChooser.APPROVE_OPTION) {
          try {
            BufferedWriter writer = new BufferedWriter(
                                      new FileWriter(
                                        filechooser.getSelectedFile()));
View Full Code Here


        final StatusBar bar = aw.getStatusBar();
        ProgressMonitor pm = bar.getProgressMonitor();

        JFileChooser fc = new JFileChooser();
        fc.setDialogTitle(tr.get(ID + ".fileDialog"));
        int res = fc.showSaveDialog(aw.getControl());
        if (res != JFileChooser.APPROVE_OPTION) {
            bar.setMessage(tr.get(ID + ".noFileSelected"));
            return;
        }
        final File f = fc.getSelectedFile();
View Full Code Here

          }
        }
      } else if (src == save) {
        JFileChooser chooser = JFileChoosers.createSelected(lastFile);
        chooser.setDialogTitle(Strings.get("saveButton"));
        int choice = chooser.showSaveDialog(HexFrame.this);
        if (choice == JFileChooser.APPROVE_OPTION) {
          File f = chooser.getSelectedFile();
          try {
            HexFile.save(f, model);
            lastFile = f;
View Full Code Here

    JFileChooser chooser = proj.createChooser();
    File oldSelected = factory.getCurrentImage(instance);
    if (oldSelected != null) chooser.setSelectedFile(oldSelected);
    chooser.setDialogTitle(Strings.get("ramSaveDialogTitle"));
    int choice = chooser.showSaveDialog(frame);
    if (choice == JFileChooser.APPROVE_OPTION) {
      File f = chooser.getSelectedFile();
      try {
        HexFile.save(f, s.getContents());
        factory.setCurrentImage(instance, f);
View Full Code Here

      }
      select.setSelectedFile(new File((new File(mSavePath).getParent())
          + File.separator + fileName + ext));
    }

    if (select.showSaveDialog(CalendarExportPlugin.getInstance()
        .getBestParentFrame()) == JFileChooser.APPROVE_OPTION) {

      String filename = select.getSelectedFile().getAbsolutePath();

      if (!filename.toLowerCase().endsWith(ext)) {
View Full Code Here

   * @param extension The file extension of the destination file
   */
  public static File showSaveFileDialog(Widget parent, String extension) {
    JFileChooser chooser = new JFileChooser();
    chooser.setFileFilter(new ExtensionFilter(extension, true));
    if (chooser.showSaveDialog(parent.getRealWidget()) == JFileChooser.APPROVE_OPTION) {
      String path = chooser.getSelectedFile().getPath();
      if (!path.endsWith("." + extension))
        path = path + "." + extension;
      return new File(path);
    } else {
View Full Code Here

      if (parentDir != null)
      {
        fileChooser.setCurrentDirectory(parentDir);
      }
    }
    final int result = fileChooser.showSaveDialog(parent);
    if (result == JFileChooser.APPROVE_OPTION)
    {
      final File resultFile = fileChooser.getSelectedFile();
      instances.put(key, resultFile);
      return resultFile;
View Full Code Here

public class FileUtils {

    public static String getFilePathToSaveFromUser(String title) {
        JFileChooser chooser = getChooser(title);
        int state = chooser.showSaveDialog(null);
        String ret = handleResponse(chooser, state);
        return ret;
    }

    public static String getFilePathToOpenFromUser(String title) {
View Full Code Here

            public void actionPerformed(ActionEvent e) {
                EsriLayer layer = pickEsriLayer();
                if (layer != null) {
                    JFileChooser fileChooser = new JFileChooser();
                    fileChooser.setFileFilter(new EsriFilter());
                    int returnVal = fileChooser.showSaveDialog(null);
                    if (returnVal == JFileChooser.APPROVE_OPTION) {
                        try {
                            File file = fileChooser.getSelectedFile();
                            String path = file.getCanonicalPath();
                            EsriGraphicList list = layer.getEsriGraphicList();
View Full Code Here

     */
    public File promptForFile(FileFilter fileFilter) {
        JFileChooser chooser = new JFileChooser();
        chooser.addChoosableFileFilter(fileFilter);

        if (chooser.showSaveDialog(parent) != JFileChooser.APPROVE_OPTION) {
            return null;
        }

        return chooser.getSelectedFile();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.