Can we use buttons in J2me MIDlet?
As far as I have read, we can use only commands as buttons.
And we can not say exactly where that commands will appear on the scree.
Is that right?
Can we use buttons in J2me MIDlet?
As far as I have read, we can use only commands as buttons.
And we can not say exactly where that commands will appear on the scree.
Is that right?
Last edited by komomo; 2010-06-14 at 04:47.
yup,
thats the short version, you can use priorities for the placement of the COmmands, but those are more an advise or a request from the developer, in the end the underlying OS will decide if the Commands will be arranged as the supplied priorities or not... most of the time it's not unfortunately
To have more control you might want to use a 3rd party gui library, like LWUIT or J2ME Polish...
As Tiger suggested, use 3rd party gui library, like LWUIT or J2ME Polish... to get buttons or make your own CustomItem as a Button or go full Canvas and define/draw on screen buttons any where and handle user events - keypress or pointere press on the button and perform you own needed action.
Thanks,
Ekta
You can use a StringItem as a button.
You need to give it the appearance mode Item.BUTTON
Then you can assign a command and a command listener, and add it to your form.
It is described in the MIPD-API of the second StringItem constructor.
Or you can use an ImageItem as Button. This works like a StringItem.
Adding buttons using StringItem or ImageItem, you will have constrain of keeping only 1 button in a row on the screen.
If you need mutiple buttons in row use some third party UI libs like LWUIT which gives you more control on placement of these buttons. Or create you own Custom Item with two buttons.
Thanks,
Ekta
Hi,
Yes Buttons in JavaMe tends to Commands and also by setting priority we can define the order of Commands. Please check the constructor of Command .. The third param tends to priority. If you want the location of buttons or command at anywhere on the screen then you can use Canvas for the same.
thanks,
jitu_goldie..
KEEP TRYING..