import java.awt.*;
import java.awt.event.*;
public class ex23
{
public static void main(String[] args)
{
Frame f = new Frame("Practice 6-2 FlowLayoutTest");
// Frameを生成する
// Buttonを生成する
Button b1 = new Button("Button1");
Button b2 = new Button("Button2");
Button b3 = new Button("Button3");
f.setSize(300, 200); // Frameのサイズを設定する
f.setLayout(new FlowLayout(FlowLayout.RIGHT));
// FrameにButtonを追加する
f.add(b1);
f.add(b2);
f.add(b3);
f.setVisible(true); // Frameを表示する
// Frameのクローズボタン(右上の×ボタン)をクリックしたときの処理
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0); // Frameを破棄する
}
});
}
}
最終更新:2010年01月03日 19:34