1
votes

I'm developing a small j2me game and i want to create a menu for this application. I imagine the menu as a vertical list of items with a cursor on the left or right side that i can move from item to item, something like this menu example but as a main menu. What elements should i use to obtains such effects? I need only advices or links, i will develope it myself.

Thanks in advance!

import java.util.Vector;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
1
what particular API do you plan to use? MIDP 2? LWUIT? J2MEPolish? Also, your menu example screen shot looks much fancier than you describe in words. "vertical list of items" - 'implicit' kind of these matches but is it what you looking for? - gnat
what i want is a combination of those: an aligned vertical list and a pointy cursor instead of the blue ball from the screen shot; like an exclusive list from your ss, but to change the look of the radio button, add a background, format text etc. I use Eclipse to develope it. - MRM
Eclipse is too broad to figure what you mean. EclipseME? did you check the documentation (online help, user guide etc) of the tool you use? what does it say about Java ME technologies? - gnat
i already did a menu using implicit lists, but it's too simple...i asked this here because i thought experienced users will give me an idea. I know how to make a simple menu, i just lack experience to make a more complex one. - MRM
I see. That menu with implicit lists you mention, could you please post what import statements were in your code (just add that list to your question)? That will help me figure what technologies you use - gnat

1 Answers

0
votes

What you plan looks doable. Can't give much links because don't recall any that could help on stuff like you're doing. Actually, most useful link for you will probably be MIDP (JSR 118) API reference - your part is going to be mostly lcdui package, and especially Graphics API.

As for advice, no problem. First thing to note is that there will be more coding and more (much more) testing/debugging than it was in your prior experiment with implicit list. If you can think of some possible deadline / timing requirements that may become a problem - just keep in mind that prior design with implicit list as a fallback. It won't look as fancy but it'll work work safe and correct.

Another important thing is to decide what kind devices you are going to target. For menu like one you are going to develop, it may be rather difficult to get consistent look and feel both at 160x200 basic phone with ITU-T keypad and on 400x600 touchscreen smartphone. Below I am going to assume you'll try to target as wide variety of devices as possible - note the narrower you can get it, the easier it will be to code and test.

When targeting lots of different devices it is helpful to use an emulator that can be configured to simulate various display sizes and resolution, presense or absence of touchscreen input etc. Keep in mind though that emulator alone won't fully simulate real device. To keep your feets on the ground, consider also some regular smoke testing of your application with real device, preferable using over-the-air (OTA) installation.

Here are some particular API tips that I can think of now.

  • Use Canvas.getGameAction to handle pressed key code - that is likely the most reliable/portable way to figure up/down and select actions for menu.
  • Use Canvas.hasPointerEvents to figure if there's touch screen support. Users with touch screen devices may get disappointed if it turns out that your fancy menu can't react when they tap on screen.
  • Use Font.getHeight and Font.stringWidth to figure how much space is occupied by menu item text.
  • Use Image.getGraphics if you want to draw something over the image object.

As I mentioned, you most likely will do a lot of stuff using lcdui.Graphics API. It's mostly rather simple, but you will probably need to understand somewhat tricky stuff about clipping. Good luck.