如何纠正 LWUIT 中找不到符号错误?
我创建了一个 LWUIT 应用程序,当我按下移动键时,它会在组件上写入字体(就像如果我按下键 2 那么它 将在屏幕上显示 2)。我正在使用 switch case 来执行此操作。
例如,
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;
:
:
:
}
}
我尝试使用这样的代码。编译它时显示,
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:
我如何解决这个问题。除了,我还需要导入一些其他头文件吗?
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
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;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
import javax.microedition.lcdui.Canvas;
,调用按键时使用Canvas.KEY_NUM0
等。Use
import javax.microedition.lcdui.Canvas;
and when you call the keys useCanvas.KEY_NUM0
, etc.