當前位置: 首頁>>代碼示例>>Java>>正文


Java FileSystemView.getFiles方法代碼示例

本文整理匯總了Java中javax.swing.filechooser.FileSystemView.getFiles方法的典型用法代碼示例。如果您正苦於以下問題:Java FileSystemView.getFiles方法的具體用法?Java FileSystemView.getFiles怎麽用?Java FileSystemView.getFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.filechooser.FileSystemView的用法示例。


在下文中一共展示了FileSystemView.getFiles方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import javax.swing.filechooser.FileSystemView; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS &&
            OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_VISTA) > 0 ) {
        FileSystemView fsv = FileSystemView.getFileSystemView();
        for (File file : fsv.getFiles(fsv.getHomeDirectory(), false)) {
            if(file.isDirectory()) {
                for (File file1 : fsv.getFiles(file, false)) {
                    if(file1.isDirectory())
                    {
                        String path = file1.getPath();
                        if(path.startsWith("::{") &&
                                path.toLowerCase().endsWith(".library-ms")) {
                            throw new RuntimeException("Unconverted library link found");
                        }
                    }
                }
            }
        }
    }
    System.out.println("ok");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:bug8003399.java

示例2: run

import javax.swing.filechooser.FileSystemView; //導入方法依賴的package包/類
public void run() {
    final Vector<DoChangeContents> runnables = new Vector<DoChangeContents>(10);
    final FileSystemView fileSystem = filechooser.getFileSystemView();

    final File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());

    final Vector<Object> acceptsList = new Vector<Object>();

    for (final File element : list) {
        // Return all files to the file chooser. The UI will disable or enable
        // the file name if the current filter approves.
        acceptsList.addElement(new SortableFile(element));
    }

    // Sort based on settings.
    sort(acceptsList);

    // Don't separate directories from files
    Vector<SortableFile> chunk = new Vector<SortableFile>(10);
    final int listSize = acceptsList.size();
    // run through list grabbing file/dirs in chunks of ten
    for (int i = 0; i < listSize;) {
        SortableFile f;
        for (int j = 0; j < 10 && i < listSize; j++, i++) {
            f = (SortableFile)acceptsList.elementAt(i);
            chunk.addElement(f);
        }
        final DoChangeContents runnable = new DoChangeContents(chunk, fid);
        runnables.addElement(runnable);
        SwingUtilities.invokeLater(runnable);
        chunk = new Vector<SortableFile>(10);
        if (isInterrupted()) {
            // interrupted, cancel all runnables
            cancelRunnables(runnables);
            return;
        }
    }

    synchronized (fileCacheLock) {
        for (final Runnable r : queuedTasks) {
            SwingUtilities.invokeLater(r);
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:45,代碼來源:AquaFileSystemModel.java

示例3: run

import javax.swing.filechooser.FileSystemView; //導入方法依賴的package包/類
public void run() {
    FileSystemView fileSystemView = FileSystemView.getFileSystemView();

    fileSystemView.getFiles(new File(dir), false);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:bug6868611.java

示例4: run

import javax.swing.filechooser.FileSystemView; //導入方法依賴的package包/類
@Override
public void run() {
    final Vector<DoChangeContents> runnables = new Vector<DoChangeContents>(10);
    final FileSystemView fileSystem = filechooser.getFileSystemView();

    final File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());

    final Vector<Object> acceptsList = new Vector<Object>();

    for (final File element : list) {
        // Return all files to the file chooser. The UI will disable or enable
        // the file name if the current filter approves.
        acceptsList.addElement(new SortableFile(element));
    }

    // Sort based on settings.
    sort(acceptsList);

    // Don't separate directories from files
    Vector<SortableFile> chunk = new Vector<SortableFile>(10);
    final int listSize = acceptsList.size();
    // run through list grabbing file/dirs in chunks of ten
    for (int i = 0; i < listSize;) {
        SortableFile f;
        for (int j = 0; j < 10 && i < listSize; j++, i++) {
            f = (SortableFile)acceptsList.elementAt(i);
            chunk.addElement(f);
        }
        final DoChangeContents runnable = new DoChangeContents(chunk, fid);
        runnables.addElement(runnable);
        SwingUtilities.invokeLater(runnable);
        chunk = new Vector<SortableFile>(10);
        if (loadThread.isInterrupted()) {
            // interrupted, cancel all runnables
            cancelRunnables(runnables);
            return;
        }
    }

    synchronized (fileCacheLock) {
        for (final Runnable r : queuedTasks) {
            SwingUtilities.invokeLater(r);
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:46,代碼來源:AquaFileSystemModel.java


注:本文中的javax.swing.filechooser.FileSystemView.getFiles方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。