Package javax.swing

Examples of javax.swing.JFileChooser.showOpenDialog()


    public void actionPerformed(ActionEvent event) {
      Object src = event.getSource();
      if (src == open) {
        JFileChooser chooser = JFileChoosers.createSelected(lastFile);
        chooser.setDialogTitle(Strings.get("openButton"));
        int choice = chooser.showOpenDialog(HexFrame.this);
        if (choice == JFileChooser.APPROVE_OPTION) {
          File f = chooser.getSelectedFile();
          try {
            HexFile.open(model, f);
            lastFile = f;
View Full Code Here


      Object src = event.getSource();
      if (src == templateButton) {
        JFileChooser chooser = JFileChoosers.create();
        chooser.setDialogTitle(Strings.get("selectDialogTitle"));
        chooser.setApproveButtonText(Strings.get("selectDialogButton"));
        int action = chooser.showOpenDialog(getPreferencesFrame());
        if (action == JFileChooser.APPROVE_OPTION) {
          File file = chooser.getSelectedFile();
          FileInputStream reader = null;
          InputStream reader2 = null;
          try {
View Full Code Here

  private void doLoad() {
    JFileChooser chooser = proj.createChooser();
    File oldSelected = factory.getCurrentImage(instance);
    if (oldSelected != null) chooser.setSelectedFile(oldSelected);
    chooser.setDialogTitle(Strings.get("ramLoadDialogTitle"));
    int choice = chooser.showOpenDialog(frame);
    if (choice == JFileChooser.APPROVE_OPTION) {
      File f = chooser.getSelectedFile();
      try {
        factory.loadImage(circState.getInstanceState(instance), f);
      } catch (IOException e) {
View Full Code Here

  /**
   * Call the FileChooser for the executable
   */
  private void changeFile() {
    JFileChooser chooser = new JFileChooser(new File(mFile.getText()));
    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
      mFile.setText(chooser.getSelectedFile().getAbsolutePath());
    }
  }
 
  /**
 
View Full Code Here

    /**
     * invoked when the user clicks the Button to open an FileChooser - Dialog
     */
    private void pathButtonPressed(ActionEvent e) {
        JFileChooser f = new JFileChooser();
        if (f.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
            mData.setProgramPath(f.getSelectedFile().toString());
            mPathTextField.setText(mData.getProgramPath());
        }
    }

View Full Code Here

      public void actionPerformed(ActionEvent e) {
        JFileChooser jfc = new JFileChooser();
        jfc.setName("请选择本地存放文件夹");
        jfc.setDialogTitle("请选择本地存放文件夹");
        jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        int rc = jfc.showOpenDialog(frmEverbox);
        if(rc == JFileChooser.APPROVE_OPTION )
          rootpathField.setText(jfc.getSelectedFile().getAbsolutePath());
      }
    });
    sl_panel.putConstraint(SpringLayout.NORTH, selectRootPathButton, -4, SpringLayout.NORTH, label_3);
View Full Code Here

        JFileChooser chooser = new JFileChooser(initialFile);
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        chooser.setMultiSelectionEnabled(false);

        File file = null;
        if (chooser.showOpenDialog(mainPanel) == JFileChooser.APPROVE_OPTION) {
            file = chooser.getSelectedFile();
        }

        return file;
    }
View Full Code Here

        JFileChooser chooser = new JFileChooser(startingDirectory);
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        chooser.setMultiSelectionEnabled(false);

        File file = null;
        if (chooser.showOpenDialog(mainPanel) == JFileChooser.APPROVE_OPTION) {
           file = chooser.getSelectedFile();
        }

       if (file != null) {
          setCustomGradleExecutor(file);
View Full Code Here

   * @param extension The file extension to look for
   */
  public static File showOpenFileDialog(Widget parent, String extension) {
    JFileChooser chooser = new JFileChooser();
    chooser.setFileFilter(new ExtensionFilter(extension, true));
    if (chooser.showOpenDialog(parent.getRealWidget()) == JFileChooser.APPROVE_OPTION) {
      return chooser.getSelectedFile();
    } else {
      return null;
    }
  }
View Full Code Here

      if (parentDir != null)
      {
        fileChooser.setCurrentDirectory(parentDir);
      }
    }
    final int result = fileChooser.showOpenDialog(parent);
    if (result == JFileChooser.APPROVE_OPTION)
    {
      final File resultFile = fileChooser.getSelectedFile();
      instances.put(key, resultFile);
      return resultFile;
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.