import java.awt.*;
public class Face extends java.applet.Applet {
public void paint( Graphics g ) {
int width = getSize().width;
int height = getSize().height;
int w = width*2/3;
int h = height*2/3;
g.setColor( Color.magenta );
g.fillOval( (width-w)/2, (height-h)/2, w, h );
g.setColor( Color.green );
g.fillOval( (width-w)/2 + w/8, (height-h)/2 + h/8, w/8, h/8 );
g.fillOval( (width-w)/2 + 5*w/8, (height-h)/2 + h/8, w/8, h/8 );
g.drawLine( (width-w)/2 + w/4, (height-h)/2 + 3*h/4,
(width-w)/2 + 3*w/4, (height-h)/2 + 3*h/4 );
}
}
|