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.