Example #1
0
 public MainForm() {
   alfa.setValue(1);
   beta.setValue(1);
   gamma.setValue(1);
   loadDatabase.addActionListener(
       e -> {
         fileChooser.setCurrentDirectory(new File(database.getText()));
         int returnVal = fileChooser.showOpenDialog(panel1);
         if (returnVal == JFileChooser.APPROVE_OPTION) {
           File file = fileChooser.getSelectedFile();
           database.setText(file.getPath());
         }
       });
   loadKeyword.addActionListener(
       e -> {
         fileChooser.setCurrentDirectory(new File(keywords.getText()));
         int returnVal = fileChooser.showOpenDialog(panel1);
         if (returnVal == JFileChooser.APPROVE_OPTION) {
           File file = fileChooser.getSelectedFile();
           keywords.setText(file.getPath());
         }
       });
   search.addActionListener(
       e -> {
         isKeywordsEnabled = keywordsEnabled.getSelectedIndex() != 0;
         DatabaseCollection.clear();
         if (isKeywordsEnabled) {
           new KeywordParser(keywords.getText()).parse();
         }
         new DocumentParser(database.getText()).parse();
         Method method1 = Method.valueOf((String) MainForm.this.method.getSelectedItem());
         Document query1 = new Document(MainForm.this.query.getText(), "", false);
         showResults(method1, query1);
       });
   oznacz.addActionListener(
       e -> {
         for (Result result : results.getSelectedValuesList()) {
           result.setMarkedAsGood(!result.isMarkedAsGood());
         }
         results.repaint();
       });
   newQuestion.addActionListener(
       e -> {
         ResultModel model = (ResultModel) results.getModel();
         Document query1 = model.getQuery();
         calculateRelevance(
             model.getResultList(),
             query1,
             (Integer) alfa.getValue(),
             (Integer) beta.getValue(),
             (Integer) gamma.getValue());
         queryHelp.setText(query1.getQueryText());
         Method method1 = Method.valueOf((String) MainForm.this.method.getSelectedItem());
         showResults(method1, query1);
       });
 }
  private void jMenuItemImportActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jMenuItemImportActionPerformed
    JFileChooser jfc = new JFileChooser();
    jfc.setMultiSelectionEnabled(true);
    if (lastPath != null) {
      jfc.setCurrentDirectory(lastPath);
    }
    int fileDialogReturnVal = jfc.showOpenDialog(this);

    // now select the file
    if (fileDialogReturnVal == JFileChooser.APPROVE_OPTION) {
      // add code here to allow selection of a document class

      DocumentClassDialog d = DocumentClassDialog.showClassDialog(this, this.theProject);

      DocumentClass selectedClass = d.getSelectedDocumentClass();

      File[] selected = jfc.getSelectedFiles();
      for (int i = 0; i < selected.length; i++) {
        theProject.addNewDocument(selected[i], 1.0f, selected[i].toString(), selectedClass);
      }

      docFrameTableModel.fireTableDataChanged();

      lastPath = new File(jfc.getSelectedFile().getPath());
    }
  } // GEN-LAST:event_jMenuItemImportActionPerformed
Example #3
0
  void onOpenFileClicked() {
    if (!maybeSave()) {
      return;
    }

    try {
      JFileChooser fc = new JFileChooser();
      FileNameExtensionFilter filter1 =
          new FileNameExtensionFilter(strings.getString("filetype." + EXTENSION), EXTENSION);
      fc.setFileFilter(filter1);

      int rv = fc.showOpenDialog(this);
      if (rv == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();

        Tournament t = new Tournament();
        t.loadFile(file);

        setTournament(file, t);
      }
    } catch (Exception e) {
      JOptionPane.showMessageDialog(
          this, e, strings.getString("main.error_caption"), JOptionPane.ERROR_MESSAGE);
    }
  }
 public void actionPerformed(ActionEvent ae) {
   String cmd = ae.getActionCommand();
   if (JOkCancelPanel.OK.equals(cmd)) {
     // update evaluator
     evaluator.name = tfName.getText();
     evaluator.type = (byte) cbType.getSelectedIndex();
     evaluator.ignoreDiagonals = cbDiagonals.isSelected();
     evaluator.investments = (byte) cbInvestment.getSelectedIndex();
     evaluator.orgFile = orgFile;
     setVisible(false);
   } else if (JOkCancelPanel.CANCEL.equals(cmd)) {
     // don't update evaluator
     setVisible(false);
   } else if (CMD_CHOOSE_FILE.equals(cmd)) {
     // get a file dialog
     JFrame f = new JFrame();
     JFileChooser jfc = Application.getFileChooser();
     int res = jfc.showOpenDialog(f);
     Application.setWorkingDirectory(jfc.getCurrentDirectory());
     if (res == JFileChooser.CANCEL_OPTION) {
       return;
     }
     orgFile = jfc.getSelectedFile();
     lOrgFileName.setText("File: " + orgFile.getName());
   }
 }
  /** Process the action event from the open button */
  public void actionPerformed(ActionEvent evt) {
    if (openDialog == null) openDialog = new JFileChooser();

    int ret_val = openDialog.showOpenDialog(this);
    if (ret_val != JFileChooser.APPROVE_OPTION) return;

    File file = openDialog.getSelectedFile();

    try {
      System.out.println("Loading external file: " + file);

      FileInputStream is = new FileInputStream(file);
      BufferedInputStream stream = new BufferedInputStream(is);
      BufferedImage img = ImageIO.read(stream);

      if (img == null) {
        System.out.println("Image load barfed");
        return;
      }

      srcIcon.setImage(img);
      srcLabel.setIcon(srcIcon);

      BufferedImage map_img = textureUtils.createNormalMap(img, null);
      mapIcon.setImage(map_img);
      mapLabel.setIcon(mapIcon);
    } catch (IOException ioe) {
      System.out.println("crashed " + ioe.getMessage());
      ioe.printStackTrace();
    }
  }
  private void findPresentation() {
    JFileChooser fileChooser = new JFileChooser();
    if (lastDirectory_ != null) fileChooser.setCurrentDirectory(lastDirectory_);
    // if (imc.lecturnity.converter.ConverterWizard.USE_CUSTOM_COLORS)
    if (USE_CUSTOM_COLORS) fileChooser.setBackground(Wizard.BG_COLOR);
    LecturnityFileFilter lff = new LecturnityFileFilter();
    fileChooser.addChoosableFileFilter(lff);
    LpdFileFilter lpf = new LpdFileFilter();
    fileChooser.addChoosableFileFilter(lpf);
    EPresentationFileFilter eff = new EPresentationFileFilter();
    fileChooser.addChoosableFileFilter(eff);
    AofFileFilter aff = new AofFileFilter();
    fileChooser.addChoosableFileFilter(aff);
    fileChooser.addChoosableFileFilter(fileChooser.getAcceptAllFileFilter());
    fileChooser.setFileFilter(lff);

    Dimension fcSize = fileChooser.getPreferredSize();
    fileChooser.setPreferredSize(new Dimension(fcSize.width + 100, fcSize.height + 50));

    int action = fileChooser.showOpenDialog(this);

    lastDirectory_ = fileChooser.getCurrentDirectory();

    if (action == fileChooser.APPROVE_OPTION) {
      File selectedFile = fileChooser.getSelectedFile();
      presentationFileField_.setText(selectedFile.getAbsolutePath());
    }
  }
Example #7
0
 private boolean setServiceParameter(
     GlobalEnvironment.PropertyType type, JLabel label, JTextField textField) {
   String name = String.valueOf(type).toLowerCase();
   String startDirectory =
       StringUtil.isEmptyOrSpaces(textField.getText())
           ? System.getProperty("user.home")
           : textField.getText();
   JFileChooser fileChooser = new JFileChooser(startDirectory);
   fileChooser.setDialogTitle("Select Emacs " + name + " directory");
   fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
   if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
     String dir = fileChooser.getSelectedFile().getAbsolutePath();
     textField.setText(dir);
     if (GlobalEnvironment.testProperty(type, dir)) {
       infoLabel.setText("Emacs " + name + " directory successfully set");
       label.setForeground(Color.black);
       return true;
     } else {
       onWrongProperty(label, type);
       return false;
     }
   } else {
     if (GlobalEnvironment.isEmacsPropertyOk(type)) return true;
     onWrongProperty(label, type);
     return false;
   }
 }
  protected void selectFile() {
    ResourceManager rm = ResourceManager.all(FilePropertyEditor.class);

    JFileChooser chooser = UserPreferences.getDefaultDirectoryChooser();

    chooser.setDialogTitle(rm.getString("DirectoryPropertyEditor.dialogTitle"));
    chooser.setApproveButtonText(rm.getString("DirectoryPropertyEditor.approveButtonText"));
    chooser.setApproveButtonMnemonic(rm.getChar("DirectoryPropertyEditor.approveButtonMnemonic"));

    File oldFile = (File) getValue();
    if (oldFile != null && oldFile.isDirectory()) {
      try {
        chooser.setCurrentDirectory(oldFile.getCanonicalFile());
      } catch (IOException e) {
        e.printStackTrace();
      }
    }

    if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(editor)) {
      File newFile = chooser.getSelectedFile();
      String text = newFile.getAbsolutePath();
      textfield.setText(text);
      firePropertyChange(oldFile, newFile);
    }
  }
  public void actionPerformed(ActionEvent e) {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setCurrentDirectory(exaktFrame.getLastCorpusPath());
    fileChooser.setDialogTitle("Open COMA Corpus file");
    fileChooser.setFileFilter(
        new javax.swing.filechooser.FileFilter() {
          public boolean accept(File f) {
            String name = f.getAbsolutePath();
            return (f.isDirectory()
                || name.substring(Math.max(0, name.length() - 3)).equalsIgnoreCase("XML")
                || name.substring(Math.max(0, name.length() - 4)).equalsIgnoreCase("COMA"));
          }

          public String getDescription() {
            return "XML files, CoMa files (*.xml, *.coma)";
          }
        });
    int retValue = fileChooser.showOpenDialog(exaktFrame);

    if (retValue == JFileChooser.APPROVE_OPTION) {
      final File file = fileChooser.getSelectedFile();
      exaktFrame.doOpen(file);
      exaktFrame.setLastCorpusPath(file);
    }
  }
Example #10
0
  private void loadTopicsFromFile() throws IOException {
    JFileChooser chooser = new JFileChooser();
    chooser.setDialogTitle("ExtempFiller2");
    chooser.setFileFilter(
        new FileFilter() {
          @Override
          public boolean accept(File f) {
            return f.isDirectory() || f.getName().toLowerCase().endsWith(".txt");
          }

          @Override
          public String getDescription() {
            return "Text Files";
          }
        });
    int response = chooser.showOpenDialog(this);
    if (response == JFileChooser.APPROVE_OPTION) {
      // get everything currently researched
      java.util.List<String> researched = managerPanel.getTopics();
      // load everything from file
      File file = chooser.getSelectedFile();
      Scanner readScanner = new Scanner(file);
      while (readScanner.hasNext()) {
        String topic = readScanner.nextLine();
        if (!researched.contains(topic)) {
          Topic t = new Topic(topic);
          managerPanel.addTopic(t);
          inQueue.add(new InMessage(InMessage.Type.RESEARCH, t));
        }
      }
    }
  }
 private void selFolder() {
   // selects a single folder, then makes table uneditable other than launch, sel res folder and
   // cancel, gui table different, just shows folder
   final JFileChooser fc = new JFileChooser(currentPath);
   fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
   int result = fc.showOpenDialog(FrontEnd.this);
   dir = fc.getSelectedFile();
   switch (result) {
     case JFileChooser.APPROVE_OPTION:
       dirImp = dir.toString();
       dtm.getDataVector().removeAllElements();
       dtm.fireTableDataChanged();
       curRow = 0;
       addRow();
       dtm.setValueAt(
           "You have chosen the folder '" + dirImp.substring(67) + "' and all of its subfolders.",
           0,
           0);
       dtm.setValueAt(dirImp.substring(67), 0, 1);
       if (table.getRowCount() > 0) {
         openF.setEnabled(false);
         openFo.setEnabled(false);
         selFo.setEnabled(false);
         canF.setEnabled(true);
       }
       selFoFl = 1;
     case JFileChooser.CANCEL_OPTION:
       break;
   }
 }
Example #12
0
  /**
   * Method performed when button clicked.
   *
   * @param event event that triggers action, here clicking of the button.
   */
  public void actionPerformed(ActionEvent event) {

    if (choiceBox.getSelectedItem().equals(CUSTOM)) {
      JFileChooser chooser = new JFileChooser(System.getProperty("user.home"));
      int returnVal = chooser.showOpenDialog(settingsPanel);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        specifiedOntology = CUSTOM;
        openFile = chooser.getSelectedFile();
        choiceBox.setEditable(true);
        choiceBox.setSelectedItem(openFile.toString());
        choiceBox.setEditable(false);
        def = false;
        if (((String) choiceBox.getSelectedItem()).endsWith(".obo")) {
          settingsPanel.getNamespacePanel().choiceBox.setEnabled(true);
        } else {
          settingsPanel.getNamespacePanel().choiceBox.setEnabled(false);
        }
      }
      if (returnVal == JFileChooser.CANCEL_OPTION) {
        choiceBox.setSelectedItem(NONE);
        specifiedOntology = NONE;
        def = true;
        settingsPanel.getNamespacePanel().choiceBox.setEnabled(false);
      }
    } else if (choiceBox.getSelectedItem().equals(NONE)) {
      specifiedOntology = NONE;
      def = true;
      settingsPanel.getNamespacePanel().choiceBox.setEnabled(false);
    } else {
      specifiedOntology = (String) choiceBox.getSelectedItem();
      def = true;
      settingsPanel.getNamespacePanel().choiceBox.setEnabled(false);
    }
  }
  public void actionPerformed(ActionEvent e) {

    // Handle open button action.
    if (e.getSource() == openButton) {
      int returnVal = fc.showOpenDialog(FileChooserDemo.this);

      if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        // This is where a real application would open the file.
        log.append("Opening: " + file.getName() + "." + newline);
      } else {
        log.append("Open command cancelled by user." + newline);
      }
      log.setCaretPosition(log.getDocument().getLength());

      // Handle save button action.
    } else if (e.getSource() == saveButton) {
      int returnVal = fc.showSaveDialog(FileChooserDemo.this);
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        // This is where a real application would save the file.
        log.append("Saving: " + file.getName() + "." + newline);
      } else {
        log.append("Save command cancelled by user." + newline);
      }
      log.setCaretPosition(log.getDocument().getLength());
    }
  }
 public void readXMLData() {
   energy = new double[0];
   magnetization = new double[0];
   numberOfPoints = 0;
   String filename = "ising_data.xml";
   JFileChooser chooser = OSPFrame.getChooser();
   int result = chooser.showOpenDialog(null);
   if (result == JFileChooser.APPROVE_OPTION) {
     filename = chooser.getSelectedFile().getAbsolutePath();
   } else {
     return;
   }
   XMLControlElement xmlControl = new XMLControlElement(filename);
   if (xmlControl.failedToRead()) {
     control.println("failed to read: " + filename);
   } else {
     // gets the datasets in the xml file
     Iterator it = xmlControl.getObjects(Dataset.class, false).iterator();
     while (it.hasNext()) {
       Dataset dataset = (Dataset) it.next();
       if (dataset.getName().equals("magnetization")) {
         magnetization = dataset.getYPoints();
       }
       if (dataset.getName().equals("energy")) {
         energy = dataset.getYPoints();
       }
     }
     numberOfPoints = magnetization.length;
     control.println("Reading: " + filename);
     control.println("Number of points = " + numberOfPoints);
   }
   calculate();
   plotFrame.repaint();
 }
 public void initGame() {
   String cfgname = null;
   if (isApplet()) {
     cfgname = getParameter("configfile");
   } else {
     JFileChooser chooser = new JFileChooser();
     chooser.setCurrentDirectory(new File(System.getProperty("user.dir")));
     chooser.setDialogTitle("Choose a config file");
     int returnVal = chooser.showOpenDialog(this);
     if (returnVal == JFileChooser.APPROVE_OPTION) {
       cfgname = chooser.getSelectedFile().getAbsolutePath();
     } else {
       System.exit(0);
     }
     // XXX read this as resource!
     // cfgname = "mygeneratedgame.appconfig";
   }
   gamecfg = new AppConfig("Game parameters", this, cfgname);
   gamecfg.loadFromFile();
   gamecfg.defineFields("gp_", "", "", "");
   gamecfg.saveToObject();
   initMotionPars();
   // unpause and copy settingswhen config window is closed
   gamecfg.setListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           start();
           requestGameFocus();
           initMotionPars();
         }
       });
   defineMedia("simplegeneratedgame.tbl");
   setFrameRate(35, 1);
 }
 public void actionPerformed(ActionEvent e) {
   saveOld();
   if (dialog.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
     readInFile(dialog.getSelectedFile().getAbsolutePath());
   }
   SaveAs.setEnabled(true);
 }
Example #17
0
  private void onTransferFileClicked() {

    if (transferingFile) return;

    int returnVal = fileChooser.showOpenDialog(this);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File file = fileChooser.getSelectedFile();

      showInfoMessage("Se selecciono el archivo " + file.getName());

      try {

        lineCount = getFileLineCount(file);

        fileReader = new FileReader(file);

        linesTransfered = 0;
        headerSent = false;
        lineCountSent = false;
        transferingFile = true;

        transmitMessage("$save");

      } catch (IOException e) {
        e.printStackTrace();
      }

    } else {
      showInfoMessage("Se cancelo la transferencia de archivo");
    }
  }
Example #18
0
 @Override
 public void actionPerformed(ActionEvent e) {
   JFileChooser f = new JFileChooser();
   f.setFileFilter(new MyFileFilter()); // 設定檔案選擇器
   int choose = f.showOpenDialog(getContentPane()); // 顯示檔案選取
   if (choose == JFileChooser.OPEN_DIALOG) { // 有開啟檔案的話,開始讀檔
     BufferedReader br = null;
     try {
       File file = f.getSelectedFile();
       br = new BufferedReader(new FileReader(file));
       TextDocument ta = new TextDocument(file.getName(), file);
       ta.addKeyListener(new SystemTrackSave());
       ta.read(br, null);
       td.add(ta);
       td.setTitleAt(docCount++, file.getName());
     } catch (Exception exc) {
       exc.printStackTrace();
     } finally {
       try {
         br.close();
       } catch (Exception ecx) {
         ecx.printStackTrace();
       }
     }
   }
 }
Example #19
0
 private void cmdLoadActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_cmdLoadActionPerformed
   // Confirm save before open another file
   if (this.isContentChanged()) {
     int ans =
         JOptionPane.showConfirmDialog(
             this,
             "The contents of "
                 + CurrentFileName
                 + " has been modified. Would you like to save the changes first?",
             "Confirm saving ...",
             JOptionPane.YES_NO_OPTION);
     if (ans == JOptionPane.YES_OPTION) {
       saveFileContent(this.CurrentFileName, rsTextArea.getText());
     }
   }
   // Select a file to open
   if (FC.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
     CurrentFileName = FC.getSelectedFile().getPath();
     String name = FC.getSelectedFile().getName();
     // Open idf/imf file
     rsTextArea.setText(getFileContent(CurrentFileName));
     setContentChanged(false);
     this.Title = name;
     notifyContentChange(false);
   }
 } // GEN-LAST:event_cmdLoadActionPerformed
Example #20
0
    @Override
    public void actionPerformed(ActionEvent e) {
      Frame frame = getFrame();
      JFileChooser chooser = new JFileChooser();
      int ret = chooser.showOpenDialog(frame);

      if (ret != JFileChooser.APPROVE_OPTION) {
        return;
      }

      File f = chooser.getSelectedFile();
      if (f.isFile() && f.canRead()) {
        Document oldDoc = getEditor().getDocument();
        if (oldDoc != null) {
          oldDoc.removeUndoableEditListener(undoHandler);
        }
        if (elementTreePanel != null) {
          elementTreePanel.setEditor(null);
        }
        getEditor().setDocument(new PlainDocument());
        frame.setTitle(f.getName());
        Thread loader = new FileLoader(f, editor.getDocument());
        loader.start();
      } else {
        JOptionPane.showMessageDialog(
            getFrame(),
            "Could not open file: " + f,
            "Error opening file",
            JOptionPane.ERROR_MESSAGE);
      }
    }
Example #21
0
  /** Call this to browse for a custom gradle executor. */
  private void browseForCustomGradleExecutor() {
    File startingDirectory = new File(SystemProperties.getInstance().getUserHome());
    File currentFile = gradlePluginLord.getCustomGradleExecutor();
    if (currentFile != null) {
      startingDirectory = currentFile.getAbsoluteFile();
    } else {
      if (gradlePluginLord.getCurrentDirectory() != null) {
        startingDirectory = gradlePluginLord.getCurrentDirectory();
      }
    }

    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);
    } else { // if they canceled, and they have no custom gradle executor specified, then we must
             // clear things
      // This will reset the UI back to 'not using a custom executor'. We can't have them check the
      // field and not have a value here.
      if (gradlePluginLord.getCustomGradleExecutor() == null) {
        setCustomGradleExecutor(null);
      }
    }
  }
Example #22
0
 public void doIt(Project project) {
   JFileChooser fileChooser = project.getOpenChooser();
   if (fileChooser.showOpenDialog(project.getComponent()) == JFileChooser.APPROVE_OPTION) {
     openFile(project, fileChooser);
   } else {
     project.setEnabled(true);
   }
 }
Example #23
0
  /** Method to load the excel file into memory */
  private void loadExcelFileButtonActionPerformed() {
    int returnVal = fc.showOpenDialog(this);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File file = fc.getSelectedFile();
      excelTextField.setText(file.getAbsolutePath());
    }
  }
Example #24
0
 private void openFile() {
   JFileChooser chooser;
   int status;
   chooser = new JFileChooser();
   status = chooser.showOpenDialog(null);
   if (status == JFileChooser.APPROVE_OPTION) readSource(chooser.getSelectedFile());
   else JOptionPane.showMessageDialog(null, "Open File dialog canceled");
 } // openFile
Example #25
0
  public void actionPerformed(ActionEvent e) {
    Object sender = e.getSource();
    /*
       if (sender == addButton)
       {
          if (project != null)
          {
            if (dirChooser != null)
            {
              dirChooser.setDialogTitle( "add a file" ) ;
              dirChooser.setFileSelectionMode( JFileChooser.FILES_ONLY) ;
              if ( dirChooser.showOpenDialog( this ) == JFileChooser.APPROVE_OPTION )
              {
                addFile( dirChooser.getSelectedFile() ) ;
              }
            }
            else System.out.println( "no chooser" ) ;
          }
          else System.out.println( "no project" ) ;
       }
       else if (sender == removeButton)
       {
         int row = table.getSelectedRow() ;

         if (project != null)
         {
           TProjectData data = project.getProjectData() ;
           TProjectFileList list = data.getAvailableLangs() ;

           TLanguageFile file = list.getData(row) ;

           list.removeLanguageVersion(file) ;

           if (list.getSize() < 1)
           {
             removeButton.setEnabled(false);
           }

           model.fireTableDataChanged();
         }

       }
       else if (sender == rescanButton)
       {

       }
       else
    */
    if (sender == this.baseButton) {
      //      dirChooser.setProjectFileFilter( (String) typeCombo.getSelectedItem() );
      dirChooser.setDialogTitle("select a base file");
      dirChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
      if (dirChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        setBaseFile(dirChooser.getSelectedFile());
        rescan();
      }
    }
  }
Example #26
0
 private void openMenuItemActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_openMenuItemActionPerformed
   final JFileChooser fc = new JFileChooser();
   int returnVal = fc.showOpenDialog(Viewer.this);
   if (returnVal == JFileChooser.APPROVE_OPTION) {
     File file = fc.getSelectedFile();
     openIso(file.getAbsolutePath());
   }
 } // GEN-LAST:event_openMenuItemActionPerformed
Example #27
0
  public void jButton1_actionPerformed(ActionEvent e) {
    JFileChooser fc = new JFileChooser();
    int returnVal = fc.showOpenDialog(parent);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
      File file = fc.getSelectedFile();
      jTextField1.setText(file.toString());
    }
  }
Example #28
0
 public static File loadFile(String ext) {
   JFileChooser fileChooser = new JFileChooser("Load File...");
   fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
   FileFilter filter = new FileNameExtensionFilter(ext, ext);
   fileChooser.setFileFilter(filter);
   fileChooser.setAcceptAllFileFilterUsed(false);
   fileChooser.showOpenDialog(null);
   return fileChooser.getSelectedFile();
 }
  @Override
  public void mouseClicked(MouseEvent e) {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setCurrentDirectory(new File(System.getProperty("user.home")));

    TypeFileFilter fileFilter = new TypeFileFilter("db");
    fileChooser.setFileFilter(fileFilter);
    int result = fileChooser.showOpenDialog(_parent);
  }
Example #30
0
      public void actionPerformed(ActionEvent evt) {
        File directory = new File(field.getText());
        JFileChooser chooser = new JFileChooser(directory.getParent());
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        chooser.setSelectedFile(directory);

        if (chooser.showOpenDialog(SwingInstall.this) == JFileChooser.APPROVE_OPTION)
          field.setText(chooser.getSelectedFile().getPath());
      }