import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
 public class BorderLayoutTest extends JFrame implements ActionListener
 {
 private JButton B[];
 private String S[]={"Hide North","Hide South","Hide East",
 "Hide West","Hide Center"};

 public BorderLayoutTest(String s)
 {
 super(s);
 setLayout(new BorderLayout(5,5));
 B=new JButton[5];
 for(int i=0;i<B.length;i++)
 {
 B[i]=new JButton(S[i]);
 B[i].addActionListener(this);
 }
 add(B[0],BorderLayout.NORTH);
 add(B[1],BorderLayout.SOUTH);
 add(B[2],BorderLayout.EAST);
 add(B[3],BorderLayout.WEST);
 add(B[4],BorderLayout.CENTER);
 }

 public void actionPerformed(ActionEvent e)
 {
 for(int i=0;i<B.length;i++)
 {
 if(e.getSource()==B[i])
 B[i].setVisible(false);
 else B[i].setVisible(true);
 }
 validate();
 }
      public static void main(String[] args)
      {
        BorderLayoutTest f = new BorderLayoutTest("Border Layout format Grafic User Interphase(GUI) ");
        f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        f.setSize(800,500);
        f.setVisible(true);   
      }
 }
