This application illustrates how to print the key value with the current key pressed on the canvas. In this application we are using the keyPressed method to repaint the key name according to its key code as below:
|
protected void keyPressed(int keyCode){ keyValue = getKeyName(keyCode); repaint(); } |
The above method is created in the KeyCodeCanvas class, in which we inherited the canvas class to repaint the method.
The Application is as follows:


KeyCodesMIDlet.java
import javax.microedition.midlet.*;
|
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: J2ME Key Codes Example
Post your Comment