Fandom

Planet JFX

Dynamic Menu and Alert Box

118pages on
this wiki
Add New Page
Talk0 Share

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
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.