//file: Border1.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Border1 extends JPanel {
public Border1( ) {
setLayout(new BorderLayout( ));
add(new JButton("North"), BorderLayout.NORTH);
add(new JButton("South"), BorderLayout.SOUTH);
add(new JButton("East"), BorderLayout.EAST);
add(new JButton("West"), BorderLayout.WEST);
add(new JButton("Center"), BorderLayout.CENTER);
}
public static void main(String[] args) {
JFrame f = new JFrame("Border1");
f.addWindowListener(new WindowAdapter( ) {
public void windowClosing(WindowEvent e) { System.exit(0); }
});
f.setSize(300, 300);
f.setLocation(200, 200);
f.setContentPane(new Border1( ));
f.setVisible(true);
}
}
|