Insets クラス

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);
		Insets ins = getInsets();
		System.out.println(ins.top + " " + ins.left + " " + ins.bottom + " " + ins.right);
					// イベントアダプタ
		addWindowListener(new WinEnd());
	}

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