本文整理匯總了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);
}
}
}