hi guys i could'nt post gor last few days bcoz i was busy in a project so moving on
in previous one i told you about applets today i'll be telling you how you can perform basic level animation
it is done with the help of threads
threads are something required for
1-stop any function during execution time
2-decide speed for animation
3-suspend the programme
4-resume the programme
and many more but in this one we'll be using simple methods
Just run this programme and what it does
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
import java.awt.*;
import java.applet.*;
public class gui extends Applet
{
Thread t=null;
int i;
public void paint(Graphics g)
{
g.drawOval(200,200,10,10);
g.drawOval(175,170,100,100);
g.drawOval(241,200,10,10);
g.drawArc(219,200,10,25,200,142);
g.drawArc(200,200,50,50,200,140);
try{
for(i=0;i<10;i++)
{
repaint();
t.sleep(50);
g.drawOval(220,250,10,i);
}
for(i=220;i<233;i+=2)
{
repaint();
t.sleep(50);
g.drawLine(i,223,i,230);
}}
catch(InterruptedException ab)
{
}
}
}
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
create itscorresponding HTML file and run it
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
<html>
<body>
<applet code = "gui.class",width="500",height="500"></applet>
</body>
</html>
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]