javax.swing.filechooser

Class FileSystemView


  • public abstract class FileSystemView
    extends Object
    FileSystemView is JFileChooser's gateway to the file system. Since the JDK1.1 File API doesn't allow access to such information as root partitions, file type information, or hidden file bits, this class is designed to intuit as much OS-specific file system information as possible.

    Java Licensees may want to provide a different implementation of FileSystemView to better handle a given operating system.

    • Constructor Detail

      • FileSystemView

        public FileSystemView()
    • Method Detail

      • getFileSystemView

        public static FileSystemView getFileSystemView()
      • isRoot

        public boolean isRoot(File f)
        Determines if the given file is a root in the navigatable tree(s). Examples: Windows 98 has one root, the Desktop folder. DOS has one root per drive letter, C:\, D:\, etc. Unix has one root, the "/" directory. The default implementation gets information from the ShellFolder class.
        Parameters:
        f - a File object representing a directory
        Returns:
        true if f is a root in the navigatable tree.
        See Also:
        isFileSystemRoot(java.io.File)
      • getSystemDisplayName

        public String getSystemDisplayName(File f)
        Name of a file, directory, or folder as it would be displayed in a system file browser. Example from Windows: the "M:\" directory displays as "CD-ROM (M:)" The default implementation gets information from the ShellFolder class.
        Parameters:
        f - a File object
        Returns:
        the file name as it would be displayed by a native file chooser
        Since:
        1.4
        See Also:
        JFileChooser.getName(java.io.File)
      • getSystemTypeDescription

        public String getSystemTypeDescription(File f)
        Type description for a file, directory, or folder as it would be displayed in a system file browser. Example from Windows: the "Desktop" folder is desribed as "Desktop". Override for platforms with native ShellFolder implementations.
        Parameters:
        f - a File object
        Returns:
        the file type description as it would be displayed by a native file chooser or null if no native information is available.
        Since:
        1.4
        See Also:
        JFileChooser.getTypeDescription(java.io.File)
      • getSystemIcon

        public Icon getSystemIcon(File f)
        Icon for a file, directory, or folder as it would be displayed in a system file browser. Example from Windows: the "M:\" directory displays a CD-ROM icon. The default implementation gets information from the ShellFolder class.
        Parameters:
        f - a File object
        Returns:
        an icon as it would be displayed by a native file chooser
        Since:
        1.4
        See Also:
        JFileChooser.getIcon(java.io.File)
      • isParent

        public boolean isParent(File folder,
                       File file)
        On Windows, a file can appear in multiple folders, other than its parent directory in the filesystem. Folder could for example be the "Desktop" folder which is not the same as file.getParentFile().
        Parameters:
        folder - a File object repesenting a directory or special folder
        file - a File object
        Returns:
        true if folder is a directory or special folder and contains file.
        Since:
        1.4
      • getChild

        public File getChild(File parent,
                    String fileName)
        Parameters:
        parent - a File object repesenting a directory or special folder
        fileName - a name of a file or folder which exists in parent
        Returns:
        a File object. This is normally constructed with new File(parent, fileName) except when parent and child are both special folders, in which case the File is a wrapper containing a ShellFolder object.
        Since:
        1.4
      • isFileSystem

        public boolean isFileSystem(File f)
        Checks if f represents a real directory or file as opposed to a special folder such as "Desktop". Used by UI classes to decide if a folder is selectable when doing directory choosing.
        Parameters:
        f - a File object
        Returns:
        true if f is a real file or directory.
        Since:
        1.4
      • createNewFolder

        public abstract File createNewFolder(File containingDir)
                                      throws IOException
        Creates a new folder with a default folder name.
        Throws:
        IOException
      • isHiddenFile

        public boolean isHiddenFile(File f)
        Returns whether a file is hidden or not.
      • isFileSystemRoot

        public boolean isFileSystemRoot(File dir)
        Is dir the root of a tree in the file system, such as a drive or partition. Example: Returns true for "C:\" on Windows 98.
        Parameters:
        dir - a File object representing a directory
        Returns:
        true if f is a root of a filesystem
        Since:
        1.4
        See Also:
        isRoot(java.io.File)
      • isDrive

        public boolean isDrive(File dir)
        Used by UI classes to decide whether to display a special icon for drives or partitions, e.g. a "hard disk" icon. The default implementation has no way of knowing, so always returns false.
        Parameters:
        dir - a directory
        Returns:
        false always
        Since:
        1.4
      • isFloppyDrive

        public boolean isFloppyDrive(File dir)
        Used by UI classes to decide whether to display a special icon for a floppy disk. Implies isDrive(dir). The default implementation has no way of knowing, so always returns false.
        Parameters:
        dir - a directory
        Returns:
        false always
        Since:
        1.4
      • isComputerNode

        public boolean isComputerNode(File dir)
        Used by UI classes to decide whether to display a special icon for a computer node, e.g. "My Computer" or a network server. The default implementation has no way of knowing, so always returns false.
        Parameters:
        dir - a directory
        Returns:
        false always
        Since:
        1.4
      • getRoots

        public File[] getRoots()
        Returns all root partitions on this system. For example, on Windows, this would be the "Desktop" folder, while on DOS this would be the A: through Z: drives.
      • getHomeDirectory

        public File getHomeDirectory()
      • getDefaultDirectory

        public File getDefaultDirectory()
        Return the user's default starting directory for the file chooser.
        Returns:
        a File object representing the default starting folder
        Since:
        1.4
      • createFileObject

        public File createFileObject(File dir,
                            String filename)
        Returns a File object constructed in dir from the given filename.
      • createFileObject

        public File createFileObject(String path)
        Returns a File object constructed from the given path string.
      • getFiles

        public File[] getFiles(File dir,
                      boolean useFileHiding)
        Gets the list of shown (i.e. not hidden) files.
      • getParentDirectory

        public File getParentDirectory(File dir)
        Returns the parent directory of dir.
        Parameters:
        dir - the File being queried
        Returns:
        the parent directory of dir, or null if dir is null
      • createFileSystemRoot

        protected File createFileSystemRoot(File f)
        Creates a new File object for f with correct behavior for a file system root directory.
        Parameters:
        f - a File object representing a file system root directory, for example "/" on Unix or "C:\" on Windows.
        Returns:
        a new File object
        Since:
        1.4

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/swing/filechooser/FileSystemView.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut