Creating a menu bar


To create a new menu bar, click on an AWT or Swing menu bar component in the Component Palette, as shown below. Then click anywhere on the form on which you want to add the menu. The menu will appear under the Non-visual Components list in the Component Inspector (since it cannot be manipulated by the layout manager).

If this is the first menu bar you have added to this form, it will also appear visually on the form. Note that only the AWT MenuBar can be used as the main menu for AWT forms. The same is true for Swing forms and the JMenuBar. It is possible to add the AWT MenuBar to Swing forms and vice-versa, but you will not be able to use it as the displayed main menu for the form.

You can add multiple menu bars to one form, but only one of these can be used as the current menu bar. (You can write code to switch the current menu bar when the form is running.) To change the current menu, select the form's node in the Component Inspector, select the Code Generation properties tab, and choose the menu you want active from the drop-down list on the Menu Bar property. You can also switch the menu bars in user code while the form is running.


Contents Prev Next Index