/* String Print Applet
   JDK1.1対応版(変更なし)
		Coded By.KeN	Mar.19,1997
*/

import java.awt.Graphics;
import java.awt.Font;
import java.lang.Integer;

public class StringPrint extends java.applet.Applet {
  String s = null;
  int x = 0 , y = 0;
  String fontname = null;
  int fontsize = 0;
  int fonttype = 0;

  public void init() {
    fontname = getParameter( "font" );
    if ( fontname == null) {
      fontname = "TimesRoman";
    }
    s = getParameter( "fontsize" );
    if ( s == null) {
      s = "24";
    }
    fontsize = Integer.valueOf( s ).intValue();
    s = getParameter( "fonttype" );
    if ( s == null) {
      s = "0";
    }
    fonttype = Integer.valueOf( s ).intValue();
    s = getParameter( "x" );
    if ( s == null) {
      s = "50";
    }
    x = Integer.valueOf( s ).intValue(); 
    s = getParameter( "y" );
    if ( s == null) {
      s = "25";
    }
    y = Integer.valueOf( s ).intValue();
    s = getParameter( "text" );
    if ( s == null) {
      s = "Hello World!";
    }
    switch ( fonttype ) {
    case 1: // Bold
      setFont( new Font( fontname, Font.BOLD, fontsize ) );
      break;
    case 2: // Italic
      setFont( new Font( fontname, Font.ITALIC, fontsize ) );
      break;
    default: // Plain
      setFont( new Font( fontname, Font.PLAIN, fontsize ) );
    }
  }
  public void paint( Graphics scr ) {
    scr.drawString( s, x, y );
  }
}

