-
Notifications
You must be signed in to change notification settings - Fork 0
/
app6.java
70 lines (63 loc) · 959 Bytes
/
app6.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
<applet code="app6" height="400" width="400">
</applet>
*/
import java.applet.*;
import java.awt.*;
public class app6 extends Applet
{
int x=165;
int y=0;
int flag=0;
public void paint(Graphics g)
{
g.drawOval(x,y,70,70);
g.fillOval(x+12,y+15,15,15);
g.fillOval(x+45,y+15,15,15);
g.fillOval(x+29,y+29,12,12);
g.fillOval(x+18,y+45,35,12);
if(flag==0&&x==0&&y==165)
{
flag=1;
}
else if(flag==1&&x==165&y==330)
{
flag=2;
}
else if(flag==2&&x==330&&y==165)
{
flag=3;
}
else if(flag==3&&x==165&y==0)
{
flag=0;
}
else if(flag==0)
{
x--;
y++;
}
else if(flag==1)
{
x++;
y++;
}
else if(flag==2)
{
x++;
y--;
}
else if(flag==3)
{
x--;
y--;
}
try
{
Thread.sleep(5);
}
catch(Exception e)
{}
repaint();
}
}