PrintParam.java
import Applet2;
import java.awt.Graphics;
/** Applet2に組み込んだ機能をテストするためのPrintParamクラス */
public class PrintParam extends Applet2 {
/** 出力結果を記憶する文字列 */
public String message=null;
/** 初期設定のメソッド */
public void init() {
int i=0; float f=0.0f; boolean b=false;
try {
i = getIntParameter( "int" );
f = getFloatParameter( "float" );
b = getBooleanParameter( "boolean" );
message = "i=" + i + ", f=" + f + ", b=" + b;
} catch( Exception e ) {
message = "Error ! i=" + i + ", f=" + f + ", b=" + b;
}
}
/** 描画のメソッド */
public void paint( Graphics g ) {
g.drawString( message, 4, 20 );
}
}