The file list view sample displays the folder tree using the specified path as the root item. Selecting an optional folder displays the files under the folder.
The file list view sample uses the following classes:
JFTree
JFListView
JFChoice
JFToolbar
JFImageButton
JFStatusbar
JFPanel
Figure 1.30 File list view sample
Operation method
Toolbar
The toolbar consists of the folder path input field and command buttons.
Folder path input field
Specifying the folder to be displayed with a full path and pressing the [Enter] key displays the folder tree using the path as the root node. Path data entered can be stored in the folder path input field and the path can be selected from the list box.
Command button
The command buttons include the following:
Up: Moves the folder to the upper hierarchy and moves the selection position to the parent item.
Detail: Displays files in detail. The size and date are displayed in addition to the file names.
Update: Displays the latest information of the folder tree of the specified path.
Button display mode
The view format of the toolbar buttons can be selected from Label, Image, and Image & Label. Select the view format and press the [Enter] key.
Tree view section
The folder tree specified in the folder path input field appears in the tree view section. Selecting an optional folder displayed in the folder tree using the mouse or keyboard displays a list of files under the folder in the file list view section on the right side. The components used in the tree view section are the same as the components used in theFigure 1.28 Folder tree view sample.
File list view section
In the file list view section, selecting the folder displayed in the tree view section displays a list of files under the folder.
If the column header is clicked when the details are displayed, the column is sorted and displayed.
Status section
The status of the file list view sample is displayed in the status section.
Source codes
File list view sample:"Sample Storage Destinations"/filelistviewer/FileListViewer.java
File list view:"Sample Storage Destinations"/filelistviewer/FileList.java
Toolvar view:"Sample Storage Destinations"/filelistviewer/FileListViewerToolbar.java
Folder tree view:"Sample Storage Destinations"/jftree/filefolder/FolderTreeView.java
Folder tree view listener:"Sample Storage Destinations"/jftree/filefolder/FolderTreeViewListener.java