This section illustrates you how to create Animation. We are proving you an example defining a static variable DELAY of integer type. The object of Insets class is provides the representation of the borders i.e. left, right, top, bottom. the object of Timer class act as a thread which executes all the timer's tasks, sequentially.
The TimerTask class performs a task which can be scheduled for one-time or repeated execution by a Timer class. The method timer.schedule(timerTask, 0, DELAY) schedules the specified task for repeated fixed-delay execution.
The class Color defines an array of colors. The method fillRect() fills the rectangle with the colors showing animation.
Here is the code of CreateAnimation.java
import java.awt.*;
|
Output will be displayed as:

|
Recommend the tutorial |
Ask Questions? Discuss: How to create Animation View All Comments
Post your Comment