Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: FileChooser

[13:7] extends: FxObj

Wraps JavaFX FileChooser, a dialog that lets the user browse the file system and select one or more files to open or a location to save a file. The dialog supports an optional title, an initial directory, an initial file name, and one or more extension filters to narrow the visible files. Call show() to open a single file, showMultiple() to allow multi-selection, or showSave() to present a save-file dialog.

Methods

  • FileChooser (string Title = null)

    Constructor takes the title of the FileChooser dialog.

    • @p Title is an optional string with the title of the dialog.
    • @r this object
  • setTitle (string Title)

    Sets the dialog title with the provided string.

    • @p Title is a string with the title to set.
    • @r this object
  • setInitDir (string Dir)

    Sets the initial directory to start the FileChooser dialog in.

    • @p Dir is a string with the directory to start in.
    • @r this object
  • setInitFileName (string FileName)

    Sets the initial file name of the FileChooser dialog.

    • @p FileName is a string with the FileName to set.
    • @r this object
  • addFilter (string FilterName, list ExtList)

    Adds the FileChooser filter with the provided name and list of extensions.

    • @p FilterName is a string with the name of the filter.
    • @p ExtList is a list of file extensions for this filter. An example is ['.jpg', '.jpeg', '*.png']
    • @r this object
  • show (MainStage)

    Shows the standard FileChooser dialog with the provided main Stage object.

    • @p MainStage is the main JavaFX Stage object.
    • @r A string with the path of the file that was picked or null if no file was chosen.
  • showMultiple (MainStage)

    Shows the dialog with the provided main Stage object but allowing multiple file selection.

    • @p MainStage is the main JavaFX Stage object.
    • @r A list of strings with the files that were chosen or an empty list of none were picked.
  • showSave (MainStage)

    Shows the dialog with the provided main Stage object but for save file.

    • @p MainStage is the main JavaFX Stage object.
    • @r A string with the path of the file that was picked or null if no file was chosen.
  • getTitle ()

    Returns the dialog title.

    • @r A string with the title, or null if unset.
  • titleProperty ()

    Returns the StringProperty backing the dialog title.

    • @r An AJO wrapping javafx.beans.property.StringProperty.
  • setInitialDirectory (File)

    Sets the initial directory from a java.io.File AJO. Use setInitDir(string) for the path-string convenience helper.

    • @p File is an AJO around java.io.File, or null to clear.
    • @r this object
  • getInitialDirectory ()

    Returns the initial directory as a java.io.File AJO.

    • @r An AJO wrapping java.io.File, or null if unset.
  • initialDirectoryProperty ()

    Returns the ObjectProperty backing the initial directory.

    • @r An AJO wrapping javafx.beans.property.ObjectProperty.
  • setInitialFileName (string FileName)

    Sets the initial file name shown in the dialog.

    • @p FileName is a string with the initial file name, or null to clear.
    • @r this object
  • getInitialFileName ()

    Returns the initial file name shown in the dialog.

    • @r A string with the initial file name, or null if unset.
  • initialFileNameProperty ()

    Returns the ObjectProperty backing the initial file name.

    • @r An AJO wrapping javafx.beans.property.ObjectProperty.
  • getExtensionFilters ()

    Returns the ObservableList of ExtensionFilter entries on this dialog.

    • @r An AJO wrapping javafx.collections.ObservableList.
  • selectedExtensionFilterProperty ()

    Returns the ObjectProperty backing the selected extension filter.

    • @r An AJO wrapping javafx.beans.property.ObjectProperty.
  • setSelectedExtensionFilter (Filter)

    Sets the selected extension filter.

    • @p Filter is an AJO around javafx.stage.FileChooser$ExtensionFilter, or null.
    • @r this object
  • getSelectedExtensionFilter ()

    Returns the currently selected extension filter.

    • @r An AJO wrapping javafx.stage.FileChooser$ExtensionFilter, or null.
  • showOpenDialog (OwnerWindow)

    Shows the open-file dialog and returns the selected file AJO.

    • @p OwnerWindow is the owner Window AJO, or null.
    • @r An AJO wrapping java.io.File, or null if cancelled.
  • showOpenMultipleDialog (OwnerWindow)

    Shows the open-multiple-files dialog and returns the selected files as a List AJO.

    • @p OwnerWindow is the owner Window AJO, or null.
    • @r An AJO wrapping java.util.List, or null if cancelled.
  • showSaveDialog (OwnerWindow)

    Shows the save-file dialog and returns the selected file AJO.

    • @p OwnerWindow is the owner Window AJO, or null.
    • @r An AJO wrapping java.io.File, or null if cancelled.