Blinking in JFrame Java

前端 未结 3 783
南笙
南笙 2020-12-06 23:54

Hello guys I am doing a thread to update a ball over JFrame so I repaint the screen... and then paint the ball update its position .. and then draw the screen again ... draw

3条回答
  •  悲哀的现实
    2020-12-07 00:28

    If you want to have animations in Swing, the recommended class to use is the javax.swing.Timer . This class allows you to perform operations on the Event Dispatch Thread at regular intervals.

    • The Swing Timer tutorial
    • An animation example posted here on SO (which is linked in the Swing wiki here on SO btw)

提交回复
热议问题