本文整理汇总了Java中javax.swing.filechooser.FileSystemView.isFloppyDrive方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystemView.isFloppyDrive方法的具体用法?Java FileSystemView.isFloppyDrive怎么用?Java FileSystemView.isFloppyDrive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.filechooser.FileSystemView
的用法示例。
在下文中一共展示了FileSystemView.isFloppyDrive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
private static void test() {
File root = new File("C:\\");
System.out.println("Root Exists: " + root.exists());
System.out.println("Root Absolute Path: " + root.getAbsolutePath());
System.out.println("Root Is Directory?: " + root.isDirectory());
FileSystemView fileSystemView = FileSystemView.getFileSystemView();
NumberFormat nf = NumberFormat.getNumberInstance();
int iMax = 50000;
long lastPercentFinished = 0L;
for (int i = 0; i < iMax; i++) {
long percentFinished = Math.round(((i * 1000d) / (double) iMax));
if (lastPercentFinished != percentFinished) {
double pf = ((double) percentFinished) / 10d;
String pfMessage = String.valueOf(pf) + " % (" + i + "/" + iMax + ")";
long totalMemory = Runtime.getRuntime().totalMemory() / 1024;
long freeMemory = Runtime.getRuntime().freeMemory() / 1024;
long maxMemory = Runtime.getRuntime().maxMemory() / 1024;
String memMessage = "[Memory Used: " + nf.format(totalMemory) +
" kb Free=" + nf.format(freeMemory) +
" kb Max: " + nf.format(maxMemory) + " kb]";
System.out.println(pfMessage + " " + memMessage);
lastPercentFinished = percentFinished;
}
boolean floppyDrive = fileSystemView.isFloppyDrive(root);
boolean computerNode = fileSystemView.isComputerNode(root);
// "isDrive()" seems to be the painful method...
boolean drive = fileSystemView.isDrive(root);
}
}