Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 3

Program:

import java.awt.*;
import java.applet.*;

public class animated1 extends Applet {


public void paint(Graphics g) {
int a = 150, b = 170, c = 10, d = 10;
for (int i = 0; i <= 10; i++) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {

}
g.drawOval(a, b, c, d);
a -= 10;
b -= 10;
c += 8;
d += 8;

}
}

/*<applet code = animated1.class width = 1000 height = 1000></applet> */


Output:
Program:
import java.awt.*;
import java.applet.*;

public class face extends Applet {


public void paint(Graphics g) {
g.setColor(Color.yellow);
g.fillOval(20, 20, 150, 150);
g.setColor(Color.black);
g.fillOval(50, 60, 15, 25);
g.fillOval(120, 60, 15, 25);

int x[] = {95, 85, 106, 95};


int y[] = {85, 104, 104, 85};

g.drawPolygon(x, y, 4);
g.drawArc(55, 95, 78, 50, 0, -180);
g.drawLine(50, 126, 60, 116);
g.drawLine(128, 115, 139, 126);

}
}
/*<applet code = face.class width = 400 height = 300></applet> */

Output:

You might also like