[英]Is there an update/refresh method in Swing components?
I'm noob to Swing. 我对Swing说道。 I want to have a moving object on a JPanel from point to point.
我希望从点到点在JPanel上有一个移动对象。 Is there a method which is being called repeatedly so I can stick there coordinate increase?
是否有一种被重复调用的方法,所以我可以坚持坐标增加?
Even though one exists: repaint()
, it will almost never be used if your code is written correctly. 即使存在一个:
repaint()
,如果你的代码写得正确,它几乎不会被使用。 Just obey the Swing threading rules and you should be OK. 只要遵守Swing线程规则就可以了。 Here is a good article about it:
这是一篇很好的文章:
http://www.pushing-pixels.org/2007/12/06/unwritten-rule-of-working-with-swings-edt.html http://www.pushing-pixels.org/2007/12/06/unwritten-rule-of-working-with-swings-edt.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.