1

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?

Community
  • 1
  • 1
Oscar Valdez Esquea
  • 890
  • 1
  • 11
  • 26

1 Answers1

0

The TextBox and TextField objects are high-level GUI stuff, available when doing javax.microedition.lcdui.Form stuff.

In order to use keyPressed() and keyReleased() you must use javax.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.Canvas which gives you a Form-like API with all the things javax.microedition.lcdui.Form is missing.

mr_lou
  • 1,910
  • 2
  • 14
  • 26