GUI: RectangleComponent

November 5th, 2013

Classwork:
Exercise 5: Write a program,CurrentTime.java that uses a timer to print the current time once a second. Hint: The following code prints the current time:


Date now = new Date(); System.out.println(now);

The Date class is in the java.util package.

Exercise 6: Change the RectangleComponent, BouncingSqr.java for the animation program so that the rectangle bounces off the edges of the component rather than simply moving outside.

Homework:
Exercise 7: Write a program, AnimatedCar.java that animates a car so that it moves across a frame.