Skip to content

Dialogs (FXGL 11)

Almas Baimagambetov edited this page May 30, 2020 · 4 revisions

Sometimes we want to show a dialog in our game to obtain user input. There are a few built-in dialogs available, including a "generic" one for custom controls. Furthermore, each built-in dialog can be view-customized by providing own DialogFactoryService. For example:

settings.setEngineServiceProvider(DialogFactoryService.class, CustomDialogFactoryService.class);

If you want a quick sample with all of these dialogs, try out Dialogs Sample. Otherwise, each built-in dialog is given below.

Message Dialog

getDialogService().showMessageBox("This is a simple message box", () -> {
    // code to run after dialog is dismissed
});

Input Dialog

Error Dialog

Confirmation Dialog

Custom Dialog

Clone this wiki locally