问题
I am using canvas for drawing Strings in mobile screen based on the user input using key pressed event. Here my user wants to enter alphanumeric character like abc. For example user try to enter 'd' then it will display 3 instead of 'd'. So, do I get both String and numeric and able to draw in the mobile screen?
回答1:
Na if you're doing it in Canvas, you'll need to implement your own typing. I guess you'll have a 2D array of characters for each number. [['a', 'b', 'c'], ['d', 'e', 'f']...
You'll also need to implement a timeout after which you move on to the next character.
Not to mention detecting if the user has a QWERTY keyboard (Nokia E71 etc).
Basically, you have to implement it all yourself; there's no shortcut for this.
来源:https://stackoverflow.com/questions/4517767/how-to-handle-keypressed-event-in-canvas-for-alphanumeric-using-j2me-midp2-0