Skip to content

Instantly share code, notes, and snippets.

@PVaid
Last active May 26, 2017 12:37
Show Gist options
  • Save PVaid/fc03f619848e296b50ece3a5a6f14158 to your computer and use it in GitHub Desktop.
Save PVaid/fc03f619848e296b50ece3a5a6f14158 to your computer and use it in GitHub Desktop.
Drawing a smiley using an Applet viewer
/*<applet Code="DemoApplet.class" width=800 height=600>
</applet>*/
import java.applet.*;
import java.awt.*;
public class DemoApplet extends Applet
{
public void paint(Graphics g)
{
g.drawOval(40,40,120,150); //head
g.drawOval(57,75,30,20); //left eye
g.drawOval(110,75,30,20); //right eye
g.fillOval(68,81,10,10); //right pupil
g.fillOval(121,81,10,10); //left pupil
g.drawOval(85,100,30,30); //nose
g.setColor(Color.red); //default colour red
g.fillArc(60,125,80,40,180,180); //mouth
g.drawOval(25,92,15,30); //left ear
g.drawOval(162,92,15,30); //right ear
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment