FileDocCategorySizeDatePackage
SecondApplet.javaAPI DocExample1362Sat Jun 02 02:43:36 BST 2001None

SecondApplet

public class SecondApplet extends Applet
This applet spices up "Hello World" with graphics, colors, and a font.

Fields Summary
static final String
message
private Font
font
Constructors Summary
Methods Summary
public voidinit()


  // One-time initialization for the applet
  // Note: no constructor defined.
     
    font = new Font("Helvetica", Font.BOLD, 48);
  
public voidpaint(java.awt.Graphics g)

    // The pink oval
    g.setColor(Color.pink);
    g.fillOval(10, 10, 330, 100);

    // The red outline. Java doesn't support wide lines, so we
    // try to simulate a 4-pixel wide line by drawing four ovals.
    g.setColor(Color.red);
    g.drawOval(10,10, 330, 100);
    g.drawOval(9, 9, 332, 102);
    g.drawOval(8, 8, 334, 104);
    g.drawOval(7, 7, 336, 106);

    // The text
    g.setColor(Color.black);
    g.setFont(font);
    g.drawString(message, 40, 75);