Scientific Programming II

Programming in Java

Threads Assignment


Problem 1

Write a program that bounces a red ball inside of a JApplet. The ball should begin moving at the start of the applet's execution. When the ball hits the edge of the JApplet, it should bounce off of the edge and continue in the opposite direction. The ball should be updated using Runnable.

Problem 2

Extend Problem 1 to display a shadow below the ball. This shadow should be an oval shape (2.5D) and extend/retract based on the height of the ball.

Problem 3

Extend Problem 2 to add more balls on the clicking of a mouse by adding a class MouseHandler that extends from java.awt.event.MouseAdapter to handle the mouse events.