/*----------------------------------------------- テキストボックスとラベルの表示 ------------------------------------------------*/ import java.applet.*; import java.awt.*; public class Applet_Textbox extends Applet { TextField txt1; // テキストボックス用の変数定義 Label title,label; // ラベル変数の定義 public void init() { title=new Label("数当てゲームを始めます"); title.setBackground(Color.green); // 背景色 title.setForeground(Color.red); // 文字色 this.add(title); // タイトルの表示 label=new Label("数字を入れてください"); this.add(label); txt1=new TextField(10); this.add(txt1); // テキストボックスの表示 } }