10

ADDING ANIMATION AND COLLISION DETECTION WITH TIMERS

Image

In this chapter, we’ll add timer-based animation to our BubbleDraw app to create floating, bouncing bubbles, and we’ll enhance the app with a user-friendly GUI interface. The enhanced app, called BubbleDrawGUI, will add a JPanel containing the GUI components shown in Figure 10-1, giving the user the power to animate or pause the bubbles, change the animation speed, and clear the screen.

Image

Figure 10-1: The enhanced BubbleDrawGUI app features animated, bouncing, semitransparent bubbles, with a ...

Get Learn Java the Easy Way now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.