import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Layout {
public static void main(String[] args) {
JFrame frame = new JFrame("Test");
JPanel panel = new JPanel();
JButton bt = new JButton("EAST");
JButton bt1 = new JButton("WEST");
JButton bt2= new JButton("SOUTH");
JButton bt3 = new JButton("NORTH");
JButton bt4 = new JButton("CENTER");
panel.add(bt);
panel.add(bt1);
panel.add(bt2);
panel.add(bt3);
panel.add(bt4);
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setBackground(Color.BLACK);
frame.getContentPane().add(BorderLayout.EAST,panel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 300);
frame.setVisible(true);
}
}