import java.awt.*;
import javax.swing.*;
public class BorderLayoutExample extends JFrame {
public static void main(String[] args) {
//JFrame.setDefaultLookAndFeelDecorated(true);
JFrame bs = new JFrame();
bs.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane = bs.getContentPane();
pane.setLayout(new BorderLayout());
JButton label = new JButton("North");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.NORTH);
label = new JButton("South");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.SOUTH);
label = new JButton("East");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.EAST);
label = new JButton("West");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.WEST);
label = new JButton("Center");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.CENTER);
bs.setSize(400, 300);
bs.setVisible(true);
}
}
import javax.swing.*;
public class BorderLayoutExample extends JFrame {
public static void main(String[] args) {
//JFrame.setDefaultLookAndFeelDecorated(true);
JFrame bs = new JFrame();
bs.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane = bs.getContentPane();
pane.setLayout(new BorderLayout());
JButton label = new JButton("North");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.NORTH);
label = new JButton("South");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.SOUTH);
label = new JButton("East");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.EAST);
label = new JButton("West");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.WEST);
label = new JButton("Center");
label.setFont(new Font("Courier", Font.BOLD, 36));
pane.add(label, BorderLayout.CENTER);
bs.setSize(400, 300);
bs.setVisible(true);
}
}