FileDialog

Table of contents
  1. Dialog creation
  2. Showing a FileDialog

This section showcases the different types of file dialogs in the BGW framework. FileDialog can be used to display a popup to choose a file or directory either to load or save resources.

Dialog creation

The FileDialog class provides different FileDialogModes:

  • OPEN_FILE
  • OPEN_MULTIPLE_FILES
  • SAVE_FILE
  • CHOOSE_DIRECTORY

Depending on the selection the Dialog will request the appropriate type (file vs. directory) and enable multi-selection.

An example with all dialog types can be found here:

View it on GitHub

Showing a FileDialog

To show a dialog use #showFileDialog in BoardGameApplication. The operation blocks user input until the dialog is closed. The function returns an Optional containing the chosen list of Files. The Optional is empty if the dialog is canceled.