(Automatically generated from BeanInfo)
A javax.swing.JFileChooser is returned, unless the user passes in a subclass of JFileChooser as the value argument, in which case the value argument is returned.
Example of a dialog to choose .xls files:
import javax.swing.filechooser.FileFilter
def openExcelDialog = fileChooser(dialogTitle:"Choose an excel file",
id:"openExcelDialog", fileSelectionMode : JFileChooser.FILES_ONLY,
//the file filter must show also directories, in order to be able to look into them
fileFilter: [getDescription: {-> "*.xls"}, accept:{file-> file ==~ /.*?\.xls/ || file.isDirectory() }] as FileFilter) {
}
//later, in the controller
def fc = openExcelDialog
if(fc.showOpenDialog() != JFileChooser.APPROVE_OPTION) return //user cancelled
model.configFile = fc.selectedFile
|