Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

left and right command menus in LWUIT form

Tags:

java-me

lwuit

Using LWUIT framework to develop mobile application. In LWUIT by default first command is placed in the left and subsequent commands will be placed in the right menu of the form including the command which is already placed in form left.I need to add two menus to form.Left menu contains general application specific commands such as "Minimize","Back" and "Exit". Right Menu contains screen specific commands such as "Play Audio","Play Video" etc... Initially left softbutton of the form contains the text "Options" and the right softbutton of the form contains the text "Menu". When user selects "Options", a menu will be displayed with the following commands: Minimize Back Exit When user selects right soft button "Menu", a menu will be displayed with screen specific commands: Play Audio Play Video etc... Commands of the right menu keeps changing from one form to another form, whereas the commands of left menu remains the same for all screens(forms). I know command menu can be customized by overriding "Form.createCommandList(Vector)" which returns a list. But here in my case I need two lists(menus). One at the left of the form and the other one at the right of the form.Please do help me in resolving this issue.

like image 633
jezhilvalan Avatar asked Jun 26 '09 07:06

jezhilvalan


1 Answers

A LWUIT menu is just a dialog containing a List (or buttons for touch menu or pretty much anything you want), so to implement this just create a Command called options and place it in the left soft button. When options is pressed just show the dialog with your "additional commands". Since a List can accept a command array or vector doing something like this can be really easy. You can look at the code for MenuBar which is pretty simple, you can also replace the menu bar component in the latest version LWUIT (SVN at the moment) but that seems redundant for this particular use case.

like image 200
Shai Almog Avatar answered Oct 11 '22 13:10

Shai Almog