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

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

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

JFileChooser.isFileSelectionEnabled介绍

暂无

代码示例

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

private String getStringOfFileName(File file) {
  if (file == null) {
    return null;
  } else {
    JFileChooser fc = getFileChooser();
    if (fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled()) {
      return file.getPath();
    } else {
      return file.getName();
    }
  }
}

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

private String fileNameString(File file)
{
  if (file == null)
  {
    return null;
  }
  else
  {
    JFileChooser fc= getFileChooser();
    if (fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled())
    {
      return file.getPath();
    }
    else
    {
      return file.getName();
    }
  }
}

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

private void fireSelectedFileChanged(PropertyChangeEvent e) {
  File f = (File) e.getNewValue();
  JFileChooser fc = getFileChooser();
  if (f != null
      && ((fc.isFileSelectionEnabled() && !f.isDirectory())
      || (f.isDirectory() && fc.isDirectorySelectionEnabled()))) {
    
    setFileName(getStringOfFileName(f));
  }
  //TODO button visibility code started
  if (customDirectoryProvider != null)
    approveButton.setEnabled(customDirectoryProvider.isValidCustomDirectory(f));
  //TODO button visibility code ended
}

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

private void doSelectedFileChanged(PropertyChangeEvent e)
{
  applyEdit();
  File f= (File) e.getNewValue();
  JFileChooser fc= getFileChooser();
  if (f != null
    && ((fc.isFileSelectionEnabled() && !f.isDirectory())
      || (f.isDirectory() && fc.isDirectorySelectionEnabled())))
  {
    setFileName(fileNameString(f));
  }
  else
  {
    setFileName(null);
  }
  setFileSelected();
}

代码示例来源:origin: net.sf.tinylaf/tinylaf

newDirectories.addElement(f);
else if(!isTraversable && filechooser.isFileSelectionEnabled()) {
  newFiles.addElement(f);

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

private void fireFileSelectionModeChanged(PropertyChangeEvent e) {
  clearIconCache();
  JFileChooser fc = getFileChooser();
  
  File currentDirectory = fc.getCurrentDirectory();
  if (currentDirectory != null
      && fc.isDirectorySelectionEnabled()
      && !fc.isFileSelectionEnabled()
      && fc.getFileSystemView().isFileSystem(currentDirectory)) {
    
    setFileName(currentDirectory.getPath());
  } else {
    setFileName(null);
  }
}

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

private void fireDirectoryChanged(PropertyChangeEvent e) {
  JFileChooser fc = getFileChooser();
  FileSystemView fsv = fc.getFileSystemView();
  showPopupCompletion = false;
  setFileName("");
  clearIconCache();
  File currentDirectory = fc.getCurrentDirectory();
  if(currentDirectory != null) {
    directoryComboBoxModel.addItem(currentDirectory);
    newFolderAction.setEnabled(currentDirectory.canWrite());
    getChangeToParentDirectoryAction().setEnabled(!fsv.isRoot(currentDirectory));
    updateTree(currentDirectory);
    if (fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled()) {
      if (fsv.isFileSystem(currentDirectory)) {
        setFileName(getStringOfFileName(currentDirectory));
      } else {
        setFileName(null);
      }
    }
  }
}

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

if ((chooser.isFileSelectionEnabled() && f.isFile())
  || (chooser.isDirectorySelectionEnabled()
    && fsv.isFileSystem(f)

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

&& !fc.isFileSelectionEnabled()
&& fsv.isFileSystem(currentDirectory))

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

private void doFileSelectionModeChanged(PropertyChangeEvent e)
{
  applyEdit();
  resetEditIndex();
  clearIconCache();
  listSelectionModel.clearSelection();
  JFileChooser fc= getFileChooser();
  File currentDirectory= fc.getCurrentDirectory();
  if (currentDirectory != null
    && fc.isDirectorySelectionEnabled()
    && !fc.isFileSelectionEnabled()
    && fc.getFileSystemView().isFileSystem(currentDirectory))
  {
    setFileName(currentDirectory.getPath());
  }
  else
  {
    setFileName(null);
  }
}

相关文章

JFileChooser类方法