Package javax.swing

Examples of javax.swing.JFileChooser.showOpenDialog()


      public void actionPerformed(ActionEvent event) {
        File file = new File(tf.getText());
        JFileChooser fileChooser = new JFileChooser(file.getParent());
        String[] extArr = { ".jpg", ".jpeg", ".gif", ".png" };
        fileChooser.setFileFilter(new util.ui.ExtensionFileFilter(extArr, ".jpg, .gif, png"));
        if (fileChooser.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
          File selection = fileChooser.getSelectedFile();
          if (selection != null) {
            tf.setText(selection.getAbsolutePath());
          }
        }
View Full Code Here


        Designer.findWindowFor(this) == null ?
        null : Designer.findWindowFor(this).getFrame();
      JFileChooser chooser = Designer.getChooser();
      chooser.setDialogTitle(I18N.get("Report.select_source_file"));
      Designer.setPrefsDir(chooser, "dataSourceDir");
      int returnVal = chooser.showOpenDialog(frame);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        Designer.savePrefsDir(chooser, "dataSourceDir");
        dataSource.setSourceFile(chooser.getSelectedFile().getPath());
      } else {
        throw new UserCancellationException(I18N.get("Report.user_cancelled"));
View Full Code Here

   */
  private void changeIcon() {
    JFileChooser fileChooser = new JFileChooser(mIconFile);
    String[] extArr = { ".jpg", ".jpeg", ".gif", ".png" };
    fileChooser.setFileFilter(new util.ui.ExtensionFileFilter(extArr, ".jpg, .gif, .png"));
    if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
      File selection = fileChooser.getSelectedFile();
      if (selection != null) {
        mIconFile = selection;
        mIconLabel.setIcon(createUserIcon());
      }
View Full Code Here

        ProgressMonitor pm = bar.getProgressMonitor();

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

              if (this.modelsDirectory != null) {
                fileChooser.setCurrentDirectory(this.modelsDirectory);
              }
              fileChooser.setDialogTitle(dialogTitle);
              fileChooser.setMultiSelectionEnabled(true);
              if (fileChooser.showOpenDialog((JComponent)parentView) == JFileChooser.APPROVE_OPTION) {
                // Retrieve current directory for future calls
                this.modelsDirectory = fileChooser.getCurrentDirectory();
                // Return selected files separated by path separator character
                String files = "";
                for (File selectedFile : fileChooser.getSelectedFiles()) {
View Full Code Here

        final ProgressMonitor pm = bar.getProgressMonitor();

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

                // see MySwingWorker.construct -> it could be that site is not accessible
                // -> then the ui should not freeze
            } else {
                JFileChooser fc = new JFileChooser();
                fc.setDialogTitle(tr.get(ID + ".fileDialog"));
                int resultFC = fc.showOpenDialog(aw.getControl());
                if (resultFC != JFileChooser.APPROVE_OPTION) {
                    bar.setMessage(tr.get(ID + ".noFileSelected"));
                    return;
                }
                file = fc.getSelectedFile();
View Full Code Here

                    tr.get(ID + ".downloadQuestion"), JOptionPane.YES_NO_OPTION);
            if (resultDownload == JOptionPane.YES_OPTION) {
            } else {
                JFileChooser fc = new JFileChooser();
                fc.setDialogTitle(tr.get(ID + ".fileDialog"));
                int res = fc.showOpenDialog(getApplicationWindow().getControl());
                if (res != JFileChooser.APPROVE_OPTION) {
                    bar.setMessage(tr.get(ID + ".noFileSelected"));
                    return;
                }
View Full Code Here

        final ProgressMonitor pm = bar.getProgressMonitor();

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

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

        JFileChooser fc = new JFileChooser();
        fc.setDialogTitle(tr.get(ID + ".fileDialog"));
        int res = fc.showOpenDialog(aw.getControl());
        if (res != JFileChooser.APPROVE_OPTION) {
            bar.setMessage(tr.get(ID + ".noFileSelected"));
            return;
        }
        file = fc.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.