Reputation: 31
I have Created one LWUIT Application Which writes the Fonts on the Component when I press Mobile Keys(like If i press key 2 then it will Display 2 on the screen).I am using switch case to do that.
For Example,
public void keyPressed(int key)
{
// some codes here .....
switch(key)
{
case KEY_NUM0:
// some code to write 0 on the screen and breaks;
case KEY_NUM1:
// some code to write 1 on the screen and breaks;
:
:
:
}
}
I tried with like this code.while compiling it shows,
C:\Documents and Settings\Rtbi\j2mewtk\2.5.2\apps\javaForm1\src\javaForm.java:185:
cannot find symbol
symbol : variable KEY_NUM0
location: class javaForm
case KEY_NUM0:
how can i resolve this problem.Do I need to import some other header files apart from,
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
Upvotes: 1
Views: 131
Reputation: 4437
Use import javax.microedition.lcdui.Canvas;
and when you call the keys use Canvas.KEY_NUM0
, etc.
Upvotes: 1