You access the Menu Editor by opening the Java file in the Java Visual Editor, which makes the Structure window visible. Then, in the Structure window, when you click on a menu, menu item, or menu root node, the Menu Editor appears.
There are multiple ways that you work with the Menu Editor to create menus:
For instance, you can type labels directly into the menu component which has the current focus in the Menu Editor as indicated by the highlighted box. Pressing Enter validates the label and lets you type the next menu component label. You can also use the keyboard arrow keys to move the current focus in the Menu Editor to another position in the menu you want to edit. The Esc key changes the focus from anywhere inside a menu to the menu bar.
In addition to labels that you specify, you can insert various menu components either through the Menu Editor toolbar or the commands duplicated by right-clicking on a menu component. These operations are supported by the toolbar and context menu:
Additionally, you can rearrange entire menus or single menu items using drag and drop operations by clicking along the menus in the menu bar or inside the menus in their menu items.
JDeveloper synchronizes your changes as you work. As you edit menu items in the Menu Editor, all changes are reflected in the source code by the Code Editor and the Property Inspector. When you make changes to the menus in the source code or the Property Inspector, those changes are reflected in the Menu Editor.
For example, when you add a Menu
to a MenuBar
component, this Menu
appears in the Structure window as a
child of the MenuBar
. Also, when you change properties for
Menu
or MenuItem
(like text
or enabled
), those changes are reflected in the code, Menu Editor, and Property
Inspector.
Since JDeveloper also maintains synchronization with the Code Editor,
there is no need to save your menu design manually. JDeveloper generates
the code which you can view and edit in the Code Editor as you use the
Menu Editor. The generated code is saved when you save your Java source
file. The next time you open the Java file and select a MenuBar
component in the Structure window, the Menu Editor will open and
reload everything for that component.
Once you add a menu component to the UI design, you can use the Menu Editor to design the menu structure. To activate the menus in the user interface, you must use the Property Inspector to attach the menu items to events, or enter the code manually in the Code Editor.
Copyright © 1997, 2004, Oracle. All rights reserved.