javax.swing.JFileChooser.setFileHidingEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中javax.swing.JFileChooser.setFileHidingEnabled()方法的一些代码示例,展示了JFileChooser.setFileHidingEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFileChooser.setFileHidingEnabled()方法的具体详情如下:
包路径:javax.swing.JFileChooser
类名称:JFileChooser
方法名:setFileHidingEnabled

JFileChooser.setFileHidingEnabled介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

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();
 }
}

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

: filesOnly ? JFileChooser.FILES_ONLY :
    JFileChooser.FILES_AND_DIRECTORIES);
chooser.setFileHidingEnabled(fileHiding);
chooser.setControlButtonsAreShown(controlButtonsShown);
chooser.setAcceptAllFileFilterUsed(useAcceptAllFileFilter);

代码示例来源:origin: winder/Universal-G-Code-Sender

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;
}

代码示例来源:origin: winder/Universal-G-Code-Sender

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;
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

private static JFileChooser newFileChooser() {
  final JFileChooser fc = new JFileChooser(BASE_DIR);
  fc.setDialogTitle(resources.getString("fileChooser.title"));
  fc.setFileHidingEnabled(false);
  return fc;
}

代码示例来源:origin: stackoverflow.com

JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileHidingEnabled(false);
fileChooser.showOpenDialog(null);

代码示例来源:origin: apache/batik

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) {
      }
    }
  }
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

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) {
      }
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-docker-ui

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

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-nativeexecution-nb

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;
  }
}

代码示例来源:origin: net.java.truecommons/truecommons-key-swing

private JFileChooser newFileChooser() {
  final JFileChooser fc = new JFileChooser(getDirectory());
  fc.setDialogTitle(resources.getString("fileChooser.title"));
  fc.setFileHidingEnabled(false);
  return fc;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-docker-ui

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

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-docker-ui

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

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

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) {
      }
    }
  }
}

代码示例来源:origin: apache/batik

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) {
      }
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-project-ant-ui

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

代码示例来源:origin: org.codehaus.mevenide/nb-project

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

代码示例来源:origin: FellowTraveler/otapij

/**
 * Creates new form GetJavaPath
 */
public GetJavaPath() {
  initComponents();
  this.setLocationRelativeTo(null);
  chooser.setFileHidingEnabled(false);
  chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
}

代码示例来源:origin: chungkwong/MathOCR

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());
    }
  }
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch-protocol

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();
 }
}

相关文章

JFileChooser类方法