Class FileExplorer

All Implemented Interfaces:
ImageObserver, MenuContainer, Closeable, Serializable, AutoCloseable, EventListener, Accessible, TreeSelectionListener, TreeWillExpandListener, Scrollable

public class FileExplorer extends JTree implements TreeSelectionListener, TreeWillExpandListener, Closeable
A simple file explorer based on JTree that automatically monitors the filesystem for changes using a WatchService.

When files or directories are created or deleted inside any directory that is currently visible in the tree, the corresponding DirectoryTreeNode is refreshed on the Event Dispatch Thread so that the tree stays in sync without requiring a manual reload.

A right-click context menu provides Rename and Delete operations. Files and directories can also be moved by dragging a node and dropping it onto a directory node.

FileExplorer implements Closeable; call close() when the component is no longer needed to stop the background watcher thread and release the underlying OS watch handles. If close() is not called the watcher thread is a daemon thread and will be reclaimed when the JVM exits.

See Also: