Hi,
Welcome to JavaRanch!
Events are handled in the same
thread that does screen painting. You can't loop forever in the painting method, or events will never get handled -- as you've observed.
So what you must do to do animation is create a separate thread which loops and calls repaint() periodically. Then override paint() (or paintComponent(), in a Swing application) and in that method, draw the screen
once based on the values of various member variables. In your event handlers, manipulate those member variables. The end result is that periodically, the screen is repainted in a different state.
For examples of this architecture, check out the "demos" directory in your JDK distribution -- there are a large number of examples.