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

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

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

JFileChooser.isMultiSelectionEnabled介绍

暂无

代码示例

代码示例来源:origin: UISpec4J/UISpec4J

public void process(JFileChooser fileChooser) {
  boolean actual = fileChooser.isMultiSelectionEnabled();
  if (actual != enabled) {
   AssertAdapter.fail(actual ? "Multi selection is enabled." : "Multi selection is not enabled.");
  }
 }
});

代码示例来源:origin: orbisgis/orbisgis

public File[] getSelectedFiles() {
  if (fileChooser.isMultiSelectionEnabled()) {
    return fileChooser.getSelectedFiles();
  } else {
    return new File[] { fileChooser.getSelectedFile() };
  }
}

代码示例来源:origin: org.gephi/directory-chooser

private void fireMultiSelectionChanged(PropertyChangeEvent e) {
  if (getFileChooser().isMultiSelectionEnabled()) {
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
  } else {
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    getFileChooser().setSelectedFiles(null);
  }
}

代码示例来源:origin: org.gephi/directory-chooser

@Override
  public void focusGained(FocusEvent e) {
    if (!getFileChooser().isMultiSelectionEnabled()) {
      tree.clearSelection();
    }
  }
});

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

private File[] getSelectedFiles() {
  File files[];
  if (chooser.isMultiSelectionEnabled()) {
    files = chooser.getSelectedFiles();
  } else {
    if (chooser.getSelectedFile() != null) {
      files = new File[] { chooser.getSelectedFile() };
    } else {
      files = new File[0];
    }
  }
  for (int i = 0; i < files.length; i++) {
    // #135677 - user could type "../folder" and pressed OK 
    //           normalize such a filename:
    files[i] = FileUtil.normalizeFile(files[i]);
  }
  return files;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void focusGained(FocusEvent e)
  {
    if (!getFileChooser().isMultiSelectionEnabled())
    {
      listSelectionModel.clearSelection();
    }
  }
});

代码示例来源:origin: com.l2fprod.common/l2fprod-common-directorychooser

if (chooser.isMultiSelectionEnabled()) {
 tree.getSelectionModel().setSelectionMode(
  TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);

代码示例来源:origin: pentaho/pentaho-reporting

if ( fileChooser.isMultiSelectionEnabled() ) {
 selectedFiles = fileChooser.getSelectedFiles();
} else {

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-j2me-cdc-platform

if (chooser.isMultiSelectionEnabled()) {
  addFiles(chooser.getSelectedFiles(), model);
} else {

代码示例来源:origin: joel-costigliola/assertj-swing

@RunsInEDT
static void setSelectedFiles(final @Nonnull JFileChooser fileChooser, final @Nonnull File[] files) {
 execute(() -> {
  checkEnabledAndShowing(fileChooser);
  if (files.length > 1 && !fileChooser.isMultiSelectionEnabled()) {
   throw new IllegalStateException(concat("Expecting file chooser ", format(fileChooser),
                       " to handle multiple selection"));
  }
  for (File file : files) {
   checkSelectionMode(fileChooser, file);
  }
  fileChooser.setSelectedFiles(files);
 });
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

JFileChooser fc= getFileChooser();
int index= list.locationToIndex(e.getPoint());
if ((!fc.isMultiSelectionEnabled()
  || fc.getSelectedFiles().length <= 1)
  && index >= 0

代码示例来源:origin: com.l2fprod.common/l2fprod-common-directorychooser

File newFolder = new File(currentDirectory, newFolderName);
if (newFolder.mkdir()) {
 if (fc.isMultiSelectionEnabled()) {
  fc.setSelectedFiles(new File[] {newFolder});
 } else {

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

if (chooser.isMultiSelectionEnabled()) {
  projectDirs = chooser.getSelectedFiles();
} else {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-team-ide

int option = chooser.showOpenDialog(WindowManager.getDefault().getMainWindow());
if (option == JFileChooser.APPROVE_OPTION) {
  if (chooser.isMultiSelectionEnabled()) {
    projectDirs = chooser.getSelectedFiles();
  } else {

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

if (chooser.isMultiSelectionEnabled())

代码示例来源:origin: BaseXdb/basex

final File[] fls = fc.isMultiSelectionEnabled() ? fc.getSelectedFiles() :
 new File[] { fc.getSelectedFile() };
final int fl = fls.length;

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

private void doMultiSelectionChanged(PropertyChangeEvent e)
{
  if (getFileChooser().isMultiSelectionEnabled())
  {
    listSelectionModel.setSelectionMode(
      ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  }
  else
  {
    listSelectionModel.setSelectionMode(
      ListSelectionModel.SINGLE_SELECTION);
    listSelectionModel.clearSelection();
    getFileChooser().setSelectedFiles(null);
  }
}

代码示例来源:origin: org.gephi/directory-chooser

@Override
public void installComponents(JFileChooser fc) {
  fileChooser = fc;
  
  fc.setFocusCycleRoot(true);
  fc.setBorder(new EmptyBorder(4, 10, 10, 10));
  fc.setLayout(new BorderLayout(8, 8));
  
  updateUseShellFolder();
  createCenterPanel(fc);
  fc.add(centerPanel, BorderLayout.CENTER);
  
  if (fc.isMultiSelectionEnabled()) {
    setFileName(getStringOfFileNames(fc.getSelectedFiles()));
  } else {
    setFileName(getStringOfFileName(fc.getSelectedFile()));
  }
  
  if(fc.getControlButtonsAreShown()) {
    addControlButtons();
  }
  
  createPopup();
}

代码示例来源:origin: org.gephi/directory-chooser

tree.addTreeSelectionListener(dirHandler);
if(fileChooser.isMultiSelectionEnabled()) {
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
} else {

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

void setFileSelected()
  if (getFileChooser().isMultiSelectionEnabled() && !isDirectorySelected())

相关文章

JFileChooser类方法