Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望在我的 Java2D 模拟器中定期调用 repaint()。
最好的方法是什么?我应该启动另一个线程并有一个循环来跟踪 currentTimeMillis() 吗?或者,还有更好的方法?
在 java ( javax.swing.Timer )中使用定时器功能
这可能对你有用的重绘方法
使用计时器。如果它是 Swing 应用程序,请使用 Swing 计时器。如果它的 AWT 则使用 TimerTask。