VerticalBox with WindowListener

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class VerticalBox {
public static void main (String args[]) {
Frame f = new Frame("Vertical Box");
Box box = Box.createVerticalBox();
box.add (new Button ("Top"));
box.add (Box.createVerticalStrut (25));
box.add (new Button ("Middle"));
box.add (Box.createRigidArea (new Dimension (5000000, 10)));
box.add (new Button ("Bottom"));
f.add (box, BorderLayout.CENTER);
f.setSize (200, 150);
f.setVisible (true);
f.addWindowListener (new WindowAdapter() {
public void windowClosing (WindowEvent e) {
System.exit(0);
}
});
}
}

Comments

Popular Posts