To convert from AWT to AFC, instances of java.awt.MenuBar should be transformed into instances of com.ms.ui.UIBand.
MenuBar extends MenuComponent: be sure to see its changes.
AFC applications do not need a separate menu bar. Instead, the UIBand class can be used to create a menu bar by adding UIMenuButtons to it. Similarly, UIBand can be used to make a tool bar by adding UIPushButtons to it.
The difference this creates applies mainly to frames: in AWT's Frame, you would use setMenuBar to create a new menu bar. In a UIFrame, you simply add your UIBand bar to the UIFrame (or UIContainer). This gives you more flexibility in choosing the location and container of the menu bar.
This is the set of changes you need to make to port all MenuBar methods to UIBand methods. Any method not listed here or below does not need to be changed.
AWT Code | AFC Code | Comments |
MenuBar() | UIBand() or UIBand(String) or UIBand(String, int) |
The String input is displayed on the UIBand; the int refers to a style involving breaks between bands. See the documentation for more information. |
countMenus() | getComponentCount() | Deprecated in AWT 1.1 |
getMenu(int) | getComponent(int) | |
getMenuCount() | getComponentCount() |
Some methods in java.awt.MenuBar are not directly supported in com.ms.ui.UIBand. Those methods and suggested changes are described here.
AWT Code/Suggested AFC Code | Comments |
add(Menu) add(UIMenuButton) |
UIMenuButtons typically contain UIMenuLists for menus: see above and the documentation for more information. |
deleteShortcut(MenuShortCut) (no suggestions) |
Shortcuts are implemented by default as an incremental type search. |
getHelpMenu() (no suggestions) |
In AFC, you do not specify which UIMenuList is fixed as the help menu. |
getShortcutMenuItem(MenuShortcut) (no suggestions) |
Shortcuts are implemented by default as an incremental type search. |
remove(MenuComponent) remove(UIComponent) |
AFC uses UIComponents instead of MenuComponents. |
setHelpMenu(Menu) (no suggestions) |
In AFC, you do not specify which UIMenuList is fixed as the help menu. |
shortcuts() (no suggestions) |
Shortcuts are implemented by default and so this information is not available. |