Chapter 10

Making Menus

In This Chapter

arrow Creating basic and dynamic menus

arrow Working with separators and action listeners

arrow Constructing menus with check boxes and radio buttons

arrow Creating submenus and custom menu items

In this chapter, you find out how to adorn your programs with menus. You work with menus in applications, so you’re probably already familiar with what menus are and how they work. I don’t review those basics in this chapter. Instead, I jump right into the details of how to create a menu and add it to a scene.

Introducing Classes for Creating Menus

The following paragraphs describe the classes you use most often when you create menus:

  • MenuBar: This class is the top-level container for menus that appear in the menu bar at the top of a scene.
  • Menu: Each menu in the menu bar is represented by a Menu object. The menu bar, as shown in Figure 10-1, has two Menu objects: one for the Game menu and the other for the Options menu. A Menu object contains a collection of MenuItem objects that display when the user clicks the menu.
  • MenuItem: Menu items are represented by the MenuItem ...

Get JavaFX For Dummies now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.