/ Demo some font special effects
import java.applet.*;
import java.awt.*;

public class FontDemo extends Applet
  {
  Color bg;  // background
  public void init()
    {
    bg=new Color(0x80,0x80,0x80);
    setBackground(bg);
    } 


// Show text with a shadow  
  void ShadowText(Graphics g, String s, int x, int y,
  Color c1, Color c2,int amt)
    {
    g.setColor(c1);
    g.drawString(s,x+amt,y+amt);
    g.setColor(c2);
    g.drawString(s,x,y);
    } 

// outline text
  void OutlineText(Graphics g, String s, int x, int y, Color c1, Color c2)
    {
    int amt=1;
    g.setColor(c1);
    g.drawString(s,x-amt,y-amt);
    g.drawString(s,x-amt,y+amt);
    g.drawString(s,x+amt,y-amt);
    g.drawString(s,x+amt,y+amt);
    g.setColor(c2);
    g.drawString(s,x,y);
    } 


// 3D text
  void ThreeDText(Graphics g, String s, int x, int y, Color c1, 
                  Color c2, Color c3, int amt)
    {
    int i;
    x=x-5;
    y=y-5;
    for (i=0;i<5;i+=amt)
      {
      g.setColor(c1);
      g.drawString(s,x+i,y+i-1);
      g.setColor(c2);
      g.drawString(s,x+i-1,y+i);
      } 
    g.setColor(c3);
    g.drawString(s,x+5,y+5);
    } 

  public void paint(Graphics g)
    {
    int x,y;
    Color c1,c2,c3;
    Font f = new Font("SansSerif",java.awt.Font.BOLD,20);
    c1=new Color(0,0,0);
    c2=new Color(0xFF,0,0);
    c3=new Color(0xFF,0x80,0);
    g.setFont(f);
    x=10;
    y=20;
    g.setColor(c2);
    g.drawString("Font Samples",x,y);
    y=50;
    ShadowText(g,"Web Techniques",x,y,c1,c2,2);
    y=70;
    ShadowText(g,"www.webtechniques.com",x,y,c2,c1,1);
    y=100;
    OutlineText(g,"Java@Work",x,y,c1,c2,1);
    y=130;
    OutlineText(g,"by Al Williams",x,y,c1,bg,1);
    y=160;
    ThreeDText(g,"Now in 3D!",x,y,c1,c2,c3,1);
    } 
  }