Planet JFX

Here is a quick example of how to use simple dialogs in JavaFX. Works in the interpreted version of JavaFXPad.

import javafx.ui.*;
import javafx.ui.canvas.*;
import javafx.ui.filter.*;

var f = Frame {
    menubar: MenuBar {
        menus: 
        [Menu {
            text: "Menu here!"
            items: 
            [MenuItem {
                text: "Menu Item to start a confirm dialog"
                action: operation() {
                    var dlg = ConfirmDialog {
                        confirmType: YES_NO_CANCEL
                        title: "Yes / No / Cancel dialog"
                        message: "See?  A dialog is possible"
                        messageType: INFORMATION
                        onCancel: operation() {
                            println("cancel pressed");
                        }
                        onNo: operation() {
                            println("no pressed");
                        }
                        onYes: operation() {
                            println("yes pressed");
                        }
                    };
                    dlg.visible = true;
                }
            }
            ]
        }
        ]
    }
    content: Button {
        text: "Button to start a dialog"
        action: operation() {
            var otherDlg = MessageDialog {
                message: "This is a message dialog"
                title: "The message dialog title"
                messageType: ERROR
                
            };
            otherDlg.visible = true;
        }
    }
};

f.setSize(200,200);
return f;