I'm developing (or trying to) a J2ME application. I need to be able to handle onKeyEvents (keyDown/keyPressed/keyUp...) in TextEdit/TextBoxes, but I've learned that such thing is not possible in J2me, at least not in a simple way as in Java/Android development (myEdit.setOnKeyListener() for example). I've read something about using Canvas, but I'm not sure how can I use that to make it work for me.
Answer to this question ( Image in button - j2me ) involves using the CustomItem class and make an item look/act like a Button. Is there anyway to use the same approach?
The
TextBoxandTextFieldobjects are high-level GUI stuff, available when doingjavax.microedition.lcdui.Formstuff.In order to use
keyPressed()andkeyReleased()you must usejavax.microedition.lcdui.Canvas(low-level GUI stuff).But what you're probably really after, is LWUIT (https://lwuit.java.net). It is a framework built on
javax.microedition.lcdui.Canvaswhich gives you a Form-like API with all the thingsjavax.microedition.lcdui.Formis missing.