<<PREV(P) | ToC(T) | NEXT(N)>>
GridLayout
last modified: Feb./3rd/2002
コンテナを、指定された行数と列数の矩形領域に分割し、そこに部品を追加します。各矩形領域の大きさは同じになります。したがって、領域の大きさに応じて部品の大きさも変わります。
サンプル
import java.awt.*;
import java.applet.Applet;
public class ButtonGrid extends Applet {
public void init() {
this.setLayout(new GridLayout(3,2));
this.add(new Button("1"));
this.add(new Button("2"));
this.add(new Button("3"));
this.add(new Button("4"));
this.add(new Button("5"));
this.add(new Button("6"));
}
}
|
アプレット:ButtonTest2.class (200×150) |
|
|
アプレット:ButtonTest2.class (100×100) |
|
コンストラクタ
GridLayout()
- 1 行中にコンポーネントあたり 1 つの列を持つデフォルト指定でグリッドレイアウトを作成します。
GridLayout(int rows, int cols)
- 指定された数の行と列を持つグリッドレイアウトを作成します。
GridLayout(int rows, int cols, int hgap, int vgap)
- 指定された数の行と列を持つグリッドレイアウトを作成します。
<<PREV(P) | ToC(T) | NEXT(N)>>
Copyright © 2001 SUGAI, Manabu. All Rights Reserved.