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

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

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

JFileChooser.accept介绍

暂无

代码示例

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

File is : Computer
File is : Network
File is : Libraries
File is : Homegroup
File is : C:\
File is : E:\
File is : F:\
Exception in thread "Basic L&F File Loading Thread" java.lang.NullPointerException: 
  at Main$1.accept(Main.java:17)
  at javax.swing.JFileChooser.accept(JFileChooser.java:1617)
  at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run0(BasicDirectoryModel.java:252)
  at javax.swing.plaf.basic.BasicDirectoryModel$LoadFilesThread.run(BasicDirectoryModel.java:228)

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

public Vector<File> buildList(String text, File[] children) {
  Vector<File> files = new Vector<>(children.length);
  
  for(int i = children.length - 1; i >= 0; i--) {
    File completion = children[i];
    
    if(fileChooser.accept(completion)) {
      String path = completion.getAbsolutePath();
      
      if (path.regionMatches(true, 0, text, 0, text.length())) {
        
        if(fileChooser.getFileSelectionMode() == JFileChooser.DIRECTORIES_ONLY) {
          if(completion.isDirectory()) {
            files.add(completion);
          }
        } else if(fileChooser.getFileSelectionMode() == JFileChooser.FILES_ONLY) {
          if(completion.isFile()) {
            files.add(completion);
          }
        } else if(fileChooser.getFileSelectionMode() == JFileChooser.FILES_AND_DIRECTORIES) {
          files.add(completion);
        }
      }
    }
  }
  
  Collections.sort(files, DirectoryNode.FILE_NAME_COMPARATOR);
  return files;
}

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

public boolean loadChildren(JFileChooser chooser, boolean descend) {
  //fixed bug #97124
  if (loaded == false) {
    ArrayList files = getFiles(chooser);
    if (files.isEmpty()) {
      return false;
    }
    for (int i = 0; i < files.size(); i++) {
      File child = (File) files.get(i);
      if (chooser.accept(child)) {
        try {
          DirectoryNode node = new DirectoryNode(child);
          if (descend == false) {
            break;
          }
          add(node);
        } catch (NullPointerException t) {
          Exceptions.printStackTrace(t);
        }
      }
    }
    if (descend == true || (getChildCount() > 0)) {
      loaded = true;
    }
  }
  return loaded;
}

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

if(filechooser.accept(list[i])) {
  acceptsList.addElement(list[i]);

相关文章

JFileChooser类方法