本文整理汇总了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");
}
示例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);
}
}
}
示例3: run
import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
public void run() {
FileSystemView fileSystemView = FileSystemView.getFileSystemView();
fileSystemView.getFiles(new File(dir), false);
}
示例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);
}
}
}