Java ME帮助显示诺基亚教程中的日历画布 [英] Java ME help displaying calendar canvas from Nokia tutorial
问题描述
我一直在下面的教程如何在Java ME中创建一个日历小部件。我似乎不能让它工作。
I've been following below tutorial on how to create a calendar widget in Java ME. I can't seem to get it to work.
当我运行应用程序,它只是说它在后台运行。我想我不能正确初始化它。
When I run the application it just says it's running in the background. I guess I'm not initializing it properly. Where exactly to put the code located at the bottom of the page to make it display to the java phone screen?
这里的教程链接除了一些小的变量名差异的代码是相同的。
The link to the tutorial is here apart from a few minor variable name differences the code is identical.
http:// www.developer.nokia.com/Community/Wiki/Building_a_Java_ME_Canvas_based_calendar/date_picker
推荐答案
...它只是说它在后台运行。我想我不能正确初始化它。
...it just says it's running in the background. I guess I'm not initializing it properly.
没有看到你的代码很难确定,但假设你没有介绍错误复制教程代码,最可能的原因,你描述的行为是你没有调用 Display.setCurrent 。
Without seeing your code it's hard to tell for sure but assuming that you did not introduce errors copying tutorial code, the most likely reason for the behavior like you describe is that you didn't invoke Display.setCurrent. This would indeed qualify as not initializing it properly.
在扩展MIDlet的类中,确保 startApp / code>调用
setCurrent
,如下所示:
In the class that extends MIDlet, make sure that startApp
invokes setCurrent
, like as below:
public void startApp() {
Display.getDisplay(this).setCurrent(
new CalendarCanvas(this));
}
请注意上面的代码片段, CalendarCanvas
假设为您参考的教程:
Note in code snippet above, CalendarCanvas
is assumed to be as per tutorial you refer to:
- CalendarCanvas.java :Canvas中的CalendarWidget的示例用法...
- CalendarCanvas.java: sample usage of CalendarWidget within a Canvas...
这篇关于Java ME帮助显示诺基亚教程中的日历画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!