posted 12 years ago
if using a JPanel, in paintComponent()
you set the color and fillOval(x,y,w,h),
where w,h sets the size of the ball, and
x,y sets its location.
you give x,y initial values of (say) 10,100
then you start a timer to change x and/or y
and at the same time call panel.repaint()
which will 'repaint' the ball at its new location.
the time delay/interval of the timer will
determine how fast your animation appears.