private void loadReport() { final JFileChooser fc = new JFileChooser(); fc.setDialogTitle("Choose scanner report directory"); File lastReport = getLastUsedReport(); if (lastReport != null) { fc.setCurrentDirectory(lastReport); } fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fc.setFileHidingEnabled(false); fc.setApproveButtonText("Open scanner report"); int returnVal = fc.showOpenDialog(frame); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); try { setLastUsedReport(file); loadReport(file); } catch (Exception e) { JOptionPane.showMessageDialog(frame, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); exit(); } } else { exit(); } }
: filesOnly ? JFileChooser.FILES_ONLY : JFileChooser.FILES_AND_DIRECTORIES); chooser.setFileHidingEnabled(fileHiding); chooser.setControlButtonsAreShown(controlButtonsShown); chooser.setAcceptAllFileFilterUsed(useAcceptAllFileFilter);
public static JFileChooser getSettingsFileChooser() { FirmwareSettingsFileTypeFilter filter = new FirmwareSettingsFileTypeFilter(); // Setup file browser with the last path used. JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setFileHidingEnabled(true); fileChooser.addChoosableFileFilter(filter); fileChooser.setAcceptAllFileFilterUsed(true); fileChooser.setFileFilter(filter); return fileChooser; }
public static JFileChooser getGcodeFileChooser(String startDir) { //Setup the file filter for gcode files. GcodeFileTypeFilter filter = new GcodeFileTypeFilter(); // Setup file browser with the last path used. JFileChooser fileChooser = new JFileChooser(startDir); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setFileHidingEnabled(true); fileChooser.addChoosableFileFilter(filter); fileChooser.setAcceptAllFileFilterUsed(true); fileChooser.setFileFilter(filter); return fileChooser; }
private static JFileChooser newFileChooser() { final JFileChooser fc = new JFileChooser(BASE_DIR); fc.setDialogTitle(resources.getString("fileChooser.title")); fc.setFileHidingEnabled(false); return fc; }
JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileHidingEnabled(false); fileChooser.showOpenDialog(null);
public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(new File(".")); fileChooser.setFileHidingEnabled(false); int choice = fileChooser.showOpenDialog(Panel.this); if (choice == JFileChooser.APPROVE_OPTION) { File f = fileChooser.getSelectedFile(); try { fileTextField.setText(f.getCanonicalPath()); } catch (IOException ex) { } } } }
public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(new File(".")); fileChooser.setFileHidingEnabled(false); int choice = fileChooser.showOpenDialog(Panel.this); if (choice == JFileChooser.APPROVE_OPTION) { File f = fileChooser.getSelectedFile(); try { fileTextField.setText(f.getCanonicalPath()); } catch (IOException ex) { } } } }
private void socketBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_socketBrowseButtonActionPerformed JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setFileHidingEnabled(false); String text = UiUtils.getValue(socketTextField); if (text != null) { chooser.setSelectedFile(new File(text)); } if (chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this)) == JFileChooser.APPROVE_OPTION) { socketTextField.setText(chooser.getSelectedFile().getAbsolutePath()); } }//GEN-LAST:event_socketBrowseButtonActionPerformed
private File openFile() { String home = System.getProperty("user.home"); // NOI18N JFileChooser chooser = new JFileChooser(home); chooser.setMultiSelectionEnabled(false); chooser.setFileHidingEnabled(false); int dlgResult = chooser.showOpenDialog(this); if (JFileChooser.APPROVE_OPTION == dlgResult) { File result = chooser.getSelectedFile(); if (result != null && !result.exists()) { result = null; } return result; } else { return null; } }
private JFileChooser newFileChooser() { final JFileChooser fc = new JFileChooser(getDirectory()); fc.setDialogTitle(resources.getString("fileChooser.title")); fc.setFileHidingEnabled(false); return fc; }
private void certBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_certBrowseButtonActionPerformed JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setFileHidingEnabled(false); String text = UiUtils.getValue(certTextField); if (text != null) { chooser.setSelectedFile(new File(text)); } if (chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this)) == JFileChooser.APPROVE_OPTION) { certTextField.setText(chooser.getSelectedFile().getAbsolutePath()); } }//GEN-LAST:event_certBrowseButtonActionPerformed
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setFileHidingEnabled(false); String text = UiUtils.getValue(certTextField); if (text != null) { chooser.setSelectedFile(new File(text)); } if (chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this)) == JFileChooser.APPROVE_OPTION) { certTextField.setText(chooser.getSelectedFile().getAbsolutePath()); } }//GEN-LAST:event_browseButtonActionPerformed
public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(currentPath); fileChooser.setFileHidingEnabled(false); fileChooser.setFileSelectionMode (JFileChooser.FILES_AND_DIRECTORIES); if (fileFilter != null) { fileChooser.setFileFilter(fileFilter); } int choice = fileChooser.showOpenDialog(URIChooser.this); if (choice == JFileChooser.APPROVE_OPTION) { File f = fileChooser.getSelectedFile(); try { textField.setText(currentPath = f.getCanonicalPath()); } catch (IOException ex) { } } } }
public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(currentPath); fileChooser.setFileHidingEnabled(false); fileChooser.setFileSelectionMode (JFileChooser.FILES_AND_DIRECTORIES); if (fileFilter != null) { fileChooser.setFileFilter(fileFilter); } int choice = fileChooser.showOpenDialog(URIChooser.this); if (choice == JFileChooser.APPROVE_OPTION) { File f = fileChooser.getSelectedFile(); try { textField.setText(currentPath = f.getCanonicalPath()); } catch (IOException ex) { } } } }
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed JFileChooser chooser = new JFileChooser(); chooser.setFileHidingEnabled(false); FileUtil.preventFileChooserSymlinkTraversal(chooser, null); chooser.setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY); chooser.setMultiSelectionEnabled(false); chooser.setDialogTitle(NbBundle.getBundle(VariablePanel.class).getString("MSG_Choose_Folder")); if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { File file = FileUtil.normalizeFile(chooser.getSelectedFile()); locationTextField.setText(file.getAbsolutePath()); } }//GEN-LAST:event_browseButtonActionPerformed
private void btnLocalRepositoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLocalRepositoryActionPerformed JFileChooser chooser = new JFileChooser(); FileUtil.preventFileChooserSymlinkTraversal(chooser, null); chooser.setDialogTitle(NbBundle.getMessage(SettingsPanel.class, "TIT_Select")); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setFileHidingEnabled(false); String path = txtLocalRepository.getText(); if (path.trim().length() == 0) { path = new File(System.getProperty("user.home"), ".m2").getAbsolutePath(); //NOI18N } if (path.length() > 0) { File f = new File(path); if (f.exists()) { chooser.setSelectedFile(f); } } if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { File projectDir = chooser.getSelectedFile(); txtLocalRepository.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath()); } }//GEN-LAST:event_btnLocalRepositoryActionPerformed
/** * Creates new form GetJavaPath */ public GetJavaPath() { initComponents(); this.setLocationRelativeTo(null); chooser.setFileHidingEnabled(false); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); }
private void train(){ JFileChooser fileChooser=new JFileChooser(); fileChooser.setFileHidingEnabled(false); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if(fileChooser.showOpenDialog(this)==JFileChooser.APPROVE_OPTION){ trainSet.getFeatures().clear(); trainSet.getFeatures().addAll(featureChooser.stream().filter((checkBox)->checkBox.isSelected()). map((checkBox)->checkBox.getText()).collect(Collectors.toList())); trainSet.getClassifier().clear(); trainSet.getClassifier().addAll(modelChooser.stream().filter((checkBox)->checkBox.isSelected()). map((checkBox)->checkBox.getText()).collect(Collectors.toList())); trainSet.train(fileChooser.getSelectedFile()); } } }
private void loadReport() { final JFileChooser fc = new JFileChooser(); fc.setDialogTitle("Choose scanner report directory"); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fc.setFileHidingEnabled(false); fc.setApproveButtonText("Open scanner report"); int returnVal = fc.showOpenDialog(frame); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); try { loadReport(file); } catch (Exception e) { JOptionPane.showMessageDialog(frame, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); exit(); } } else { exit(); } }