復習テスト(12/9)

次のプログラムは、Button クラスのオブジェクトを 生成し、以下のようなアプレットの表示を行います。 空欄を埋めてプログラムを完成させなさい。



import java.awt.*;
import java.applet.Applet;

/** ボタンのレイアウトをテストする FlowPanel クラス */

public class FlowPanel extends Applet {

   /** インターフェイスの部品の宣言 */ 

      public Button buttons[];

   /** フォントと色の宣言 */ 

      public Font font;
      public Color color;

   /** ボタンの個数 */

      protected static final int MAX_NUM = 12;

   /** 初期設定のメソッド */

      public void init() {

            buttons = new Button[MAX_NUM];
            color = new [            ]( 35, 140, 35 );
            font = new [            ]( "TimesRoman", Font.BOLD, 18 );

            for( int i=0; i<MAX_NUM; i++ ) {
                 buttons[i] = new [            ]( "Button" + i );
                 buttons[i].setBackground( color );
                 buttons[i].setForeground( Color.white );
                 buttons[i].[           ]( font );
                 [         ]( buttons[i] );
            }
      }
}