In this example we are creating an animated line. The color of line is changing alternatively.
We use drawLine() to draw a line and setColor() method to set
the color of the line. We pass four values in drawLine() method in which
last values are fixed while value of first x is changing. The rang of the
value is -500 to 600. The color of the
line is changing by setColor() method. To remove old color and set new
one or in other words to refresh the color of line we are using repaint()
method. To display the output we are creating new html files in which we are
calling the .class file (of the source file) by using applet tag. We define the height and width
of the window for output.
Here is the code of the program :
OutPut of The Example:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: June 19, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles