In mobile application development, modern platforms such as Android,iPhone, Blackberry etc, provide capability to easily use a Menu Bar but if we were to take a more traditional programming approach, such as J2ME, it becomes difficult as there are no inbuilt Menu Bars.
However, we can use a dialog box and give the look and feel as well as functionalities of a Menu Bar and since we are using J2ME, the application would run fine on all Java-enabled devices.
Hope this helps J2ME guys :
/** * * @param title dialog title * @param menuList List contains options to show as Menu options . */ public MenuDialog(String title,List menuList) { try { setTitle(title); Image bg = Image.createImage("/com/ira/images/background.jpg"); getDialogStyle().setBgImage(bg); addComponent(menuList); addCommand(new Command("Cancel")); } catch (IOException ex) { ex.printStackTrace(); } }