Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The menu bar of an application based on the NetBeans Platform is built by the Platform itself via the System Filesystem. Every menu (as well as the menu entries) is defined in the module layer file. This allows each module to declaratively add its menu entries to the menu bar. With NetBeans Platform 7 this is even easier. Just implement the action performed when selecting a menu entry; that way, this action is supplied with an annotation and the corresponding layer entries are automatically created out of these annotations.
In Chapter 6, you learned how to create and annotate action classes. In this section you will learn how to integrate actions into the menu bar.
When creating an action with the action wizard of the NetBeans IDE (see Chapter 6) you can easily assign it to a menu and position it in the desired location via the wizard GUI. So you know what happens meanwhile in the background—to change something later or to be able to get by without the support of the NetBeans IDE—I will explain the process of creating menu entries for your own actions.