This example creates a form with a menubar. Items of the menu are added and deleted dynamically in runtime by "Add" and "Remove" buttons. If menu item is selected alert box with its name is shown.
import javafx.ui.*;
import java.lang.System;
//alert data model declaration
class AlertModel {
attribute AlertText:String;
attribute ShowAlert:boolean;
}
var am = AlertModel {
AlertText: "Text"
ShowAlert: false
};
//menu data model
class MenuSource {
attribute items:MenuItem*;
attribute malert:AlertModel;
bottom: add_button }
visible: true
}