Home
Categories
Dictionnary
Download
Project Details
Changes Log
FAQ
License

Menus



All the menus which should appear on a window must be under a menubar element. The menubartoolbar has one menupopup child which will contain the menus and does not have any attribute.

Each menu is defined using the menu element. The menu contain several menuitem elements.

GUI structure

The menubar element is unique for each window. This menubar can contain any menus as necessary.


menusdiagram

Merging menus

If several XULDocuments are installed in the same Swing frame or window, then all their menus will be merged. For example, suppose that we have the two following documents declarations:

    <window title="Window1" orient="horizontal"
      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">      
       <menubar>      
         <menu label="File">
      ...  
         </menu>
       </menubar>     
   </window>                       

and:

    <window title="Window2" orient="horizontal"
      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">      
       <menubar>      
         <menu label="Options">
      ...  
         </menu>
       </menubar>     
   </window>                       

Then we will have the following result:


menusmerged

Example

    <window id="Test" title="My Window" orient="horizontal"
      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">      
       <menubar>      
         <menu label="Colors">
            <menupopup>
               <menuitem label="Red"/>
               <menuitem label="Blue"/>
               <menuitem label="Yellow"/>
            </menupopup>
         </menu>
       </menubar>     
   </window>                       

The result is:


menu

See also


Categories: controls

Copyright 2008-2020 Herve Girod. All Rights Reserved. Documentation and source under the LGPL licence