Symbian
Symbian OS Library

FAQ-0805 How can I ensure that the CFrame menu bar can always be accessed by the user, via the "Menu" key.

[Index][spacer] [Previous] [Next]



 

Classification: Java Category: AWT
Created: 07/05/2002 Modified: 09/18/2002
Number: FAQ-0805
Platform: Symbian OS v6.0

Question:
My Nokia 9200 series Java application uses a CFrame. How can I ensure that the CFrame menu bar can always be accessed by the user, via the "Menu" key.

Answer:
Any java.awt.Frame can support a menu bar, which makes a menu hierarchy available to the user via the "Menu" key. In particular the Nokia 9200 series Java SDK contains the CFrame utility (packaged in the cawt.jar archive) which provides a java.awt.Frame with the Look and Feel (L & F) of a native (C++) frame, sized to the available screen real estate, and sporting a menu bar, with default menu options (File, Edit). The availability of the menu bar and its associated menu options is important for applications running on the 9200 series since the main CBA only provides four controls.

    Developers will frequently want to super-impose various sub views (panes) on the main (C)Frame of an application. It may be tempting to use an (or several) appropriately sized java.awt.Dialog(s) for this purpose, since a Dialog also provides a native L & F. However when a Dialog is in the foreground, it takes the focus and the menu bar of the parent Frame is now longer displayable via the "Menu" key. This can be problematic if the menu options may be required in the current context. Dialogs are fine for displaying temporary information or messages, but should not be used as permanent features of a view. Instead use Panels for subdividing the main Frame of an application into separate panes. If it is essential to get as close as possible to the native split view (Window Frames) L & F (such as used in native applications like Contacts where the "current" view is placed in an "elevated" pane with a title bar and casting a shadow on the rest of the window), then an appropriately sized Frame can be used to provide a pane. However, if a Frame is used as a sub view, make sure you pass it a reference to the menu bar of the main Frame of your application (and set it with setMenuBar(...)). Otherwise again your menu will not be available when the sub Frame is in the foreground.