rawPath = Paths.get(savedGamesPath); } else { rawPath = new JFileChooser().getFileSystemView().getDefaultDirectory().toPath();
import javax.swing.JFileChooser; javax.swing.filechooser.FileSystemView; public class GetMyDocuments { public static void main(String args[]) { JFileChooser fr = new JFileChooser(); FileSystemView fw = fr.getFileSystemView(); System.out.println(fw.getDefaultDirectory()); } }
@Override public TFileSystemView getFileSystemView() { return (TFileSystemView) super.getFileSystemView(); }
import javax.swing.JFileChooser; import javax.swing.filechooser.FileSystemView; .... JFileChooser fc = new JFileChooser(); FileSystemView fsv = fc.getFileSystemView(); if (fsv.isFloppyDrive(new File("A:"))) // is A: a floppy drive?
private static File getFileChooseDefaultDir() { JFileChooser chooser = new JFileChooser(); FileSystemView fsv = chooser.getFileSystemView(); return fsv.getDefaultDirectory(); }
private static File getFileChooseDefaultDir() { JFileChooser chooser = new JFileChooser(); FileSystemView fsv = chooser.getFileSystemView(); return fsv.getDefaultDirectory(); }
import javax.swing.JFileChooser; javax.swing.filechooser.FileSystemView; public class GetMyDocuments { public static void main(String args[]) { JFileChooser fr = new JFileChooser(); FileSystemView fw = fr.getFileSystemView(); System.out.println(fw.getDefaultDirectory()); } }
private static File getFileChooseDefaultDir() { JFileChooser chooser = new JFileChooser(); FileSystemView fsv = chooser.getFileSystemView(); return fsv.getDefaultDirectory(); }
private File[] getSelectedNodes(TreePath[] paths) { Vector<File> files = new Vector<>(); for(int i = 0; i < paths.length; i++) { File file = ((DirectoryNode)paths[i].getLastPathComponent()).getFile(); if(file.isDirectory() && fileChooser.isTraversable(file) && !fileChooser.getFileSystemView().isFileSystem(file)) { continue; } files.add(file); } return files.toArray(new File[files.size()]); }
@Override public Icon getIcon(File f) { if (f.isDirectory() && // #173958: do not call ProjectManager.isProject now, could block !f.toString().matches("/[^/]+") && // Unix: /net, /proc, etc. //NOI18N f.getParentFile() != null) { // do not consider drive roots synchronized (this) { Icon icon = knownProjectIcons.get(f); if (icon != null) { return icon; } else if (lookingForIcon == null) { lookingForIcon = f; task.schedule(20); // Only calculate one at a time. // When the view refreshes, the next unknown icon // should trigger the task to be reloaded. } } } return chooser.getFileSystemView().getSystemIcon(f); }
public String toString() { return chooser.getFileSystemView().getSystemDisplayName( (File)getUserObject()); }
public boolean canEnqueue() { return !isLoaded() && !chooser.getFileSystemView().isFloppyDrive(getFile()) && !chooser.getFileSystemView().isFileSystemRoot(getFile()); }
/** * Returns the default file icon. * * @param f * File. * @return File icon. */ public Icon getDefaultIcon(File f) { JFileChooser fileChooser = getFileChooser(); Icon icon = fileChooser.getFileSystemView().getSystemIcon(f); if (SubstanceCoreUtilities.useThemedDefaultIcon(null)) { icon = SubstanceCoreUtilities.getThemedIcon(fileChooser, icon); } return icon; } }
/** * Returns the default file icon. * * @param f * File. * @return File icon. */ public Icon getDefaultIcon(File f) { JFileChooser fileChooser = getFileChooser(); Icon icon = fileChooser.getFileSystemView().getSystemIcon(f); if (SubstanceCoreUtilities.useThemedDefaultIcon(null)) { icon = SubstanceCoreUtilities.getThemedIcon(fileChooser, icon); } return icon; } }
public Icon getIcon(File f) { Icon icon = getCachedIcon(f); if (icon != null) { return icon; } if (f != null) { icon = getFileChooser().getFileSystemView().getSystemIcon(f); } if (icon == null) { icon = super.getIcon(f); } cacheIcon(f, icon); return icon; } }
public Icon getIcon(File f) { Icon icon = getCachedIcon(f); if (icon != null) { return icon; } if (f != null) { icon = getFileChooser().getFileSystemView().getSystemIcon(f); } if (icon == null) { icon = super.getIcon(f); } cacheIcon(f, icon); return icon; } }
private void fireFileSelectionModeChanged(PropertyChangeEvent e) { clearIconCache(); JFileChooser fc = getFileChooser(); File currentDirectory = fc.getCurrentDirectory(); if (currentDirectory != null && fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled() && fc.getFileSystemView().isFileSystem(currentDirectory)) { setFileName(currentDirectory.getPath()); } else { setFileName(null); } }
public Icon getIcon(File f) { Icon icon = getCachedIcon(f); if (icon != null) { return icon; } if (OS.isOneDotFourOrMore() && f != null) { icon = getFileChooser().getFileSystemView().getSystemIcon(f); } if (icon == null) { icon = super.getIcon(f); } cacheIcon(f, icon); return icon; } }
public Icon getDefaultIcon(File f) { FileSystemView fsv = getFileChooser().getFileSystemView(); Icon icon; if (fsv.isFloppyDrive(f)) { icon = UIManager.getIcon("FileView.floppyDriveIcon"); } else if (fsv.isDrive(f)) { icon = UIManager.getIcon("FileView.hardDriveIcon"); } else if (fsv.isComputerNode(f)) { icon = UIManager.getIcon("FileView.computerIcon"); } else if (f.isDirectory()) { icon = UIManager.getIcon("FileView.directoryIcon"); } else { icon = fsv.getSystemIcon(f); if (icon == null) { icon = UIManager.getIcon("FileView.fileIcon"); } } return icon; } }