我有一个 Java 小程序 (JApplet)。此 Applet 使用 JComponent(PanelAux) 来显示定期更改的值和图像。但小程序不会自行刷新。我可以做些什么来刷新我的小程序?
//--------------------------------------------RUN
public void run()
while (true) {
try {
myThread.sleep(1000);
}
catch (InterruptedException e){
}
repaint();
}
}
//--------------------------------------------PAINT
public void paint(Graphics g)
{
dim = new Dimension(image.getWidth(this)+50,image.getHeight(this)+50);
this.resize(dim);
this.setMaximumSize(dim);
this.setMinimumSize(dim);
PanelAux panel = new PanelAux(image); //JComponent
add(panel);
super.paint(g);
}
谢谢