GridLayout

import java.awt.*;
import java.awt.event.*;

public class Test {
	public static void main (String[] args)
	{
		Win win = new Win("Test Window");
	}
}

class Win extends Frame {
	Win (String name)
	{
					// Frameクラスのコンストラクタ(Windowのタイトルを引き渡す)
		super(name);
					// Windowの大きさ
		setSize(400, 300);
					// レイアウトの変更(行,列,水平ギャップ,垂直ギャップ)
		setLayout(new GridLayout(2, 2, 5, 10));
					// テキストエリア設定
		TextArea text_a = new TextArea("Text Area", 5, 10);
		add(text_a);
					// テキストフィールド設定
		TextField text_f = new TextField("Text Field");
		add(text_f);
					// ラベルの設定
		Label lb = new Label("ラベル");
		add(lb);
					// ボタンの設定
		Button bt = new Button("OK");
		add(bt);
					// ウィンドウを表示
		setVisible(true);
					// イベントアダプタ
		addWindowListener(new WinEnd());
	}

	/******************************/
	/* 上,左,下,右の余白の設定 */
	/******************************/
	public Insets getInsets()
	{
		return new Insets(35, 10, 10, 10);
	}

	/************/
	/* 終了処理 */
	/************/
	class WinEnd extends WindowAdapter
	{
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}
	}
}