You must have Credits on your Balance to download this sample
Pages 4 (1004 words)
The DrawWindow class in Java's element package is a very useful tool and a program is written to demonstrate its capability in animation. There are methods for using arcs, lines, rectangles, circles and other forms using these basic features. Also, colors can be included through the java.awt package.
In the second screenshot, a loop has been created so that the car object drawn in the first task is repeatedly produced in a line. Also a rectangle is drawn to indicate the presence of road below the cars.
Since a composite object was required, I created a commom composite object of a car having a roof, a body and two wheels. I also added colors to it, formed efficiently many such objects and showed some animation.
I have learnt from this assignment of how useful the elements package is in creating graphics in the absence of applets. The shapes like rectangle, circles, etc are available through it for simple animations. I have also understood well of the co-ordinate values used in drawing objects. Some functions like timers are also learnt in this process.
The easiest part is creating a single composite object and also using it to create many. The tough part was in assigning the parameters of the moving objects and its color parameters for producing animation.
Not exactly what you need?