当前位置: 首页>>代码示例>>Java>>正文


Java FileSystemView.getFileSystemView方法代码示例

本文整理汇总了Java中javax.swing.filechooser.FileSystemView.getFileSystemView方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystemView.getFileSystemView方法的具体用法?Java FileSystemView.getFileSystemView怎么用?Java FileSystemView.getFileSystemView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.filechooser.FileSystemView的用法示例。


在下文中一共展示了FileSystemView.getFileSystemView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testValidRoots

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
public void testValidRoots () throws Exception {
    assertNotNull(testedFS.getRoot());    
    assertTrue(testedFS.getRoot().isValid());            
    
    FileSystemView fsv = FileSystemView.getFileSystemView();                
    File[] roots = File.listRoots();
    boolean validRoot = false;
    for (int i = 0; i < roots.length; i++) {
        FileObject root1 = FileUtil.toFileObject(roots[i]);
        if (!roots[i].exists()) {
           assertNull(root1);
           continue; 
        }
        
        assertNotNull(roots[i].getAbsolutePath (),root1);
        assertTrue(root1.isValid());
        if (testedFS == root1.getFileSystem()) {
            validRoot = true;
        }
    }
    assertTrue(validRoot);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:BaseFileObjectTestHid.java

示例2: loadWorld

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
@Override
public void loadWorld() {
    FileSystemView vueSysteme = FileSystemView.getFileSystemView();

    File defaut = vueSysteme.getDefaultDirectory();

    JFileChooser fileChooser = new JFileChooser(defaut);
    fileChooser.showDialog(this, "Load");
    if(fileChooser.getSelectedFile() != null){
        File file = new File(fileChooser.getSelectedFile().getAbsolutePath());

        FileNameExtensionFilter filter = new FileNameExtensionFilter("TEXT FILES", "txt", "Map Loader");
        fileChooser.setFileFilter(filter);

        try {

            this.mapDao.addMap(WorldLoader.genRawMapFILE(file));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:Exia-Aix-A2,项目名称:Boulder-Dash,代码行数:23,代码来源:Menu.java

示例3: 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

示例4: getDiskInfo

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
/***
 * Get Disk information.
 */
private static void getDiskInfo(){
	File[] drives = File.listRoots();
	
	systemDiskUsage.clear();
	systemInfo.clear();
	
	if(drives != null && drives.length > 0){
		for(File disk : drives){
			long totalSpace = disk.getTotalSpace();
			long usedSpace = totalSpace - disk.getFreeSpace();
			double usage = (double)usedSpace * 100 / (double)totalSpace;
			systemDiskUsage.put(disk.toString(), usage);
			
			FileSystemView fsv = FileSystemView.getFileSystemView();
			systemInfo.put(disk.toString(), fsv.getSystemTypeDescription(disk));
		}
	}
}
 
开发者ID:ParkJinSang,项目名称:Jinseng-Server,代码行数:22,代码来源:ServerStatus.java

示例5: createImageIconView

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
/**
 * 파일로부터 이미지를 그리기 위한 뷰를 반환한다.
 *
 * @Date 2015. 10. 14.
 * @param file
 * @return
 * @User KYJ
 */
public static ImageView createImageIconView(File file) {
	Image fxImage = null;
	if (file.exists()) {
		FileSystemView fileSystemView = FileSystemView.getFileSystemView();
		Icon icon = fileSystemView.getSystemIcon(file);

		BufferedImage bufferedImage = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
		icon.paintIcon(null, bufferedImage.getGraphics(), 0, 0);
		fxImage = SwingFXUtils.toFXImage(bufferedImage, null);
	} else {
		return new ImageView();
	}

	return new ImageView(fxImage);
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:24,代码来源:FxUtil.java

示例6: cleanUp

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
public static void cleanUp() {
  //gets rid of scratch files.
  FileSystemView Directories = FileSystemView.getFileSystemView();
  File homedir = Directories.getHomeDirectory();
  String homedirpath = homedir.getPath();
  String scratchpath = homedirpath + "/.jmol_WPM";
  File scratchdir = new File(scratchpath);
  if (scratchdir.exists()) {
    File[] dirListing = null;
    dirListing = scratchdir.listFiles();
    for (int i = 0; i < (dirListing.length); i++) {
      dirListing[i].delete();
    }
  }
  saveHistory();//force save of history.
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:WebExport.java

示例7: test

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
private static void test() throws Exception {
    FileSystemView fsv = FileSystemView.getFileSystemView();
    File def = new File(fsv.getDefaultDirectory().getAbsolutePath());
    ShellFolderColumnInfo[] defColumns =
            ShellFolder.getShellFolder(def).getFolderColumns();

    File[] files = fsv.getHomeDirectory().listFiles();
    for (File file : files) {
        if( "Libraries".equals(ShellFolder.getShellFolder( file ).getDisplayName())) {
            File[] libs = file.listFiles();
            for (File lib : libs) {
                ShellFolder libFolder =
                        ShellFolder.getShellFolder(lib);
                if( "Library".equals(libFolder.getFolderType() ) ) {
                    ShellFolderColumnInfo[] folderColumns =
                            libFolder.getFolderColumns();

                    for (int i = 0; i < defColumns.length; i++) {
                        if (!defColumns[i].getTitle()
                                .equals(folderColumns[i].getTitle()))
                            throw new RuntimeException("Columnn " +
                                    folderColumns[i].getTitle() +
                                    " doesn't match " +
                                    defColumns[i].getTitle());
                    }
                }
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:bug8017487.java

示例8: 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);
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:39,代码来源:FileSystemViewMemoryLeak.java

示例9: selectFile

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
public void selectFile(ActionEvent event) {
    FileChooser chooser = new FileChooser();
    FileSystemView fsv = FileSystemView.getFileSystemView();
    chooser.setInitialDirectory(fsv.getHomeDirectory());
    try {
        File file = chooser.showOpenDialog(container.getScene().getWindow());
        urlInput.setText(file.toURI().toURL().toExternalForm());
        load();
    } catch (Throwable throwable) {
        handleThrowableMessage(throwable);
    }
}
 
开发者ID:whitewoodcity,项目名称:xbrowser,代码行数:13,代码来源:TabContent.java

示例10: JmolInstance

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
private JmolInstance(JmolViewer viewer, String name,
    int width, int height, int nWidgets) {
  this.viewer = viewer;
  this.name = name;
  this.width = width;
  this.height = height;
  script = viewer.getStateInfo();
  spinOn = viewer.getBooleanProperty("_spinning");
  if (script == null) {
    LogPanel.log("Error trying to get Jmol State when saving view/instance.");
    return;
  }
  bgColor = viewer.getBackgroundArgb();
  javaname = name.replaceAll("[^a-zA-Z_0-9-]", "_"); //escape filename characters
  whichWidgets=new BitSet(nWidgets);
  FileSystemView Directories = FileSystemView.getFileSystemView();
  File homedir = Directories.getHomeDirectory();
  String homedirpath = homedir.getPath();
  String scratchpath = homedirpath + "/.jmol_WPM";
  File scratchfile = new File(scratchpath);
  if (!(scratchfile.exists())) {//make the directory if necessary. we will delete when done
    boolean made_scratchdir = scratchfile.mkdir();
    if (!(made_scratchdir)) {
      LogPanel.log(GT._("Attempt to make scratch directory failed."));
    }
  }
  pictFile = scratchpath + "/" + javaname + ".png";
  // note -- the current Jmol State for THIS computer is saved in the PNG
  viewer.createImage(pictFile, "PNG", null, 2, width, height);
  pictIsScratchFile = true;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:32,代码来源:JmolInstance.java

示例11: getIcon

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
/** Return the icon of a File.
 * <p>Unfortunately Windows and Mac require different
 * approaches.
 * 
 * @param file the file to get the icon of.
 * @return an icon for this file.
 */
public static Icon getIcon(File file) {
	if(file==null) throw new NullPointerException();
	
	if(JVM.isWindows) {
		//on Macs this appears to only return the vanilla folder/file icons:
		FileSystemView fsv = FileSystemView.getFileSystemView();
		Icon icon = fsv.getSystemIcon(file);
		return icon;
	} else {
		//but this returns different icons for different folders/icons:
		FileView fileView = getFileView();
		return fileView.getIcon(file);
	}
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:22,代码来源:FileIcon.java

示例12: buildFileChooser

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
/**
 * 构建文件选择器
 */
private static void buildFileChooser() {

	// 获取系统路径工具
	FileSystemView fileSys = FileSystemView.getFileSystemView();
	// 创建选择器
	JFileChooser fileChooser = new JFileChooser();
	// 默认路径桌面
	fileChooser.setCurrentDirectory(fileSys.getHomeDirectory());
	// 处理文件过滤
	fileChooser.setFileFilter(new FileFilter() {

		@Override
		public boolean accept(File file) {

			if (file.isDirectory()) {
				return true;
			}
			return file.getName().endsWith(UIConfig.sysConfig.config_suffix);
		}

		@Override
		public String getDescription() {

			return UIConfig.sysConfig.config_suffix;
		}
	});
	chooser = fileChooser;
}
 
开发者ID:gdcpljh,项目名称:APIManager-Java,代码行数:32,代码来源:UIEvent.java

示例13: setup

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
protected void setup(FileSystemView view) {
	if (view == null) {
		view = FileSystemView.getFileSystemView();
	}
	setFileSystemView(view);
	filterVector.add(allFileFilter);
	filterCB = new JComboBox<String>(new ComboBoxModel<String>(){
		@Override
		public void removeListDataListener(ListDataListener l) {
		}
		@Override
		public int getSize() {
			return filterVector.size();
		}
		@Override
		public String getElementAt(int index) {
			return filterVector.elementAt(index).getDescription();
		}
		@Override
		public void addListDataListener(ListDataListener l) {
		}
		@Override
		public void setSelectedItem(Object anItem) {
			selected = anItem;
		}
		Object selected;
		@Override
		public Object getSelectedItem() {
			return selected;
		}
	});

	updateUI();
	if (isAcceptAllFileFilterUsed()) {
		setFileFilter(getAcceptAllFileFilter());
	}
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:38,代码来源:JFileChooser.java

示例14: TFileSystemView

import javax.swing.filechooser.FileSystemView; //导入方法依赖的package包/类
public TFileSystemView() {
    this(FileSystemView.getFileSystemView(), null);
}
 
开发者ID:christian-schlichtherle,项目名称:truevfs,代码行数:4,代码来源:TFileSystemView.java

示例15: 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


注:本文中的javax.swing.filechooser.FileSystemView.getFileSystemView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。