O'Reilly logo

JavaFX 2.0: Introduction by Example by Carl Dea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1-7. Creating Menus

Problem

You want to create standard menus in your JavaFX applications.

Solution

Employ JavaFX’s menu controls to provide standardized menuing capabilities such as check box menus, radio menus, submenus, and separators. The following are the main classes used to create menus.

  • javafx.scene.control.MenuBar
  • javafx.scene.control.Menu
  • javafx.scene.control.MenuItem

The following code calls into play all the menuing capabilities listed previously. The example code will simulate a building security application containing menu options to turn on cameras, sound an alarm, and select contingency plans.

        primaryStage.setTitle("Chapter 1-7 Creating Menus");         Group root = new Group();         Scene scene = new Scene(root, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required