Class FileChooser
The dialog is modal and blocks the calling frame/dialog. It is therefore displayed in a separate window.
TODO:
- For mode OPEN: multiple selection
- Button "Create directory"
Implementation note: This implementation uses
javax.swing.filechooser.FileSystemView, because it provides
directory information that looks more "native". This introduces a dependency
on Swing, but since ThinG requires JDK 1.4, Swing should be there anyway.
Only a minimal set of Swing classes is loaded while using
javax.swing.filechooser.FileSystemView; alas, the loading
of javax.swing.UIManager and javax.swing.LookAndFeel
can not be avoided, although no Swing beans are actually used.
- Author:
- Dirk Moebius
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFileChooser(Dialog owner, String title, int mode) FileChooser(Frame owner, String title, int mode) -
Method Summary
Modifier and TypeMethodDescriptionvoidcbFilterChanged(int index) Thinlet callback.voidThinlet callback.voidclose()Thinlet callback.booleanvoidgoHome()Thinlet callback.voidgoUp()Thinlet callback.static voidTest method.voidok()Thinlet callback.voidsetFileFilters(FileFilter[] filters) Set the list of choosable file filters.voidsetSelectedFile(File file) voidsetShowHiddenFiles(boolean showHiddenFiles) voidshow()Show the modal dialog.voidtableHeaderChanged(Object colName, Object colType, Object colSize, Object colMod) Thinlet callback.voidThinlet callback.voidThinlet callback.voidtoggleShowHiddenFiles(boolean showHidden) Thinlet callback.
-
Field Details
-
MODE_OPEN
public static final int MODE_OPEN- See Also:
-
MODE_SAVE
public static final int MODE_SAVE- See Also:
-
-
Constructor Details
-
FileChooser
-
FileChooser
-
-
Method Details
-
show
public void show()Show the modal dialog. This halts the application until the user dismisses the dialog. -
setSelectedFile
-
getSelectedFile
-
setShowHiddenFiles
public void setShowHiddenFiles(boolean showHiddenFiles) -
getShowHiddenFiles
public boolean getShowHiddenFiles() -
setFileFilters
Set the list of choosable file filters.This replaces the default filter "All files", so care must be taken to include an all file filter in the list, if you don't want the "All files" filter to be removed.
To restore the "All files" filter and remove all custom filter, call this method with argument
null.- Parameters:
filters- the list of choosable file filters, ornull.
-
getSelectedFileFilter
-
ok
public void ok()Thinlet callback. -
close
public void close()Thinlet callback. -
goUp
public void goUp()Thinlet callback. -
goHome
public void goHome()Thinlet callback. -
toggleShowHiddenFiles
public void toggleShowHiddenFiles(boolean showHidden) Thinlet callback. -
tableRowDoubleClicked
public void tableRowDoubleClicked()Thinlet callback. -
tableRowSelected
public void tableRowSelected()Thinlet callback. -
tableHeaderChanged
Thinlet callback. -
cbPathChanged
public void cbPathChanged()Thinlet callback. -
cbFilterChanged
public void cbFilterChanged(int index) Thinlet callback. -
main
Test method.
-