我使用LWUIT在模拟器中开发一个Xlet项目。该项目是多线程的,当其中一个线程完成其工作,然后死亡或刚刚进入wain()状态时,将调用显示窗体的repaint()方法,屏幕将闪烁(拍摄时间为白屏,然后恢复正常)。
以下代码的一部分:
public class LwuitWhiteScreenXlet implements Xlet {
private Image bgImage;
Form form;
Thread thread;
public void destroyXlet(boolean arg0) throws XletStateChangeException {
// TODO Auto-generated method stub
}
public void initXlet(XletContext arg0) throws XletStateChangeException {
form = new Form();
/*Form initialize, code omitted*/
}
public void pauseXlet() {
// TODO Auto-generated method stub
}
public void startXlet() throws XletStateChangeException {
System.out.println("Xlet startXlet START++++++++++++++++++++");
thread = new Thread((new Runnable() {
public void run() {
Image image = null;
try {
image = Image.createImage("/res/arrow.png");
} catch (IOException e) {
e.printStackTrace();
}
Label labelTmp = new AnimatedLabel(image, 3);
}
}));
thread.start();
form.show();
System.out.println("Xlet startXlet END ------------------");
}
}有没有人也遇到过这个问题?
发布于 2013-11-17 03:28:50
您正在EDT中更改LWUIT代码,这是不允许的,也不受支持。我建议考虑实现Animation接口,并在Form中使用registerAnimated()。
https://stackoverflow.com/questions/19827717
复制相似问题