Command issue in J2ME

51 Views Asked by At

Currently I am working on J2ME App and I am facing command issue in j2me. When I am adding any command on form its coming under options, not coming directly on screen.

Command selCommand = new Command("Select");

This select command is not coming directly on screen, options is coming on screen then click on option command then Select command is coming.

I want Select command on screen instead of option.

2

There are 2 best solutions below

0
On

High Level GUI coding in JavaME doesn't let you decide how a Command should be displayed. The same code may display a Command directly on the screen on some devices, but under Options on other devices. So don't have any control of that.

Your best chance is to look into priorities. By setting a high priority on your Command, you may be lucky that it displays directly on the screen instead of under Options. It is not something you should count on though, since it's not required by the specification, but I suspect at least many devices would do that.

0
On

J2ME doesn't let you allow to add commands on Screen it will come in menu but we can set priority to command so that they can be visible in left or right side.

even if you want to add command on Screen you have to use buttons.

Container containerbtn;
Button btnsel = new Button("Select");
containerbtn.addComponent(btnsel );
this.addComponent(containerbtn);