Java Reference
In-Depth Information
soundAlarmItem.setToggleGroup(tGroup);
soundAlarmItem.setText("Sound Alarm");
RadioMenuItem stopAlarmItem = new RadioMenuItem();
stopAlarmItem.setToggleGroup(tGroup);
stopAlarmItem.setText("Alarm Off");
stopAlarmItem.setSelected(true);
alarm.getItems().add(soundAlarmItem);
alarm.getItems().add(stopAlarmItem);
Menu contingencyPlans = new Menu("Contingent Plans");
contingencyPlans.getItems().add(new
CheckMenuItem("Self Destruct in T minus 50"));
contingencyPlans.getItems().add(new
CheckMenuItem("Turn off the coffee machine "));
contingencyPlans.getItems().add(new
CheckMenuItem("Run for your lives! "));
alarm.getItems().add(contingencyPlans);
menuBar.getMenus().add(alarm);
menuBar.prefWidthProperty().bind(primaryStage.widthProperty());
root.getChildren().add(menuBar);
primaryStage.setScene(scene);
primaryStage.show();
}
Figure 14-7 shows a simulated building security application containing checked,
and submenu items.
 
Search WWH ::




Custom Search