import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class JPaneltest extends JApplet
{
  private JPanel buttonPanel;
  private JButton buttons[];

  public void init()
  {
  buttonPanel=new JPanel();
  buttons=new JButton[5];
  buttonPanel.setLayout(new GridLayout(1,buttons.length));
  for(int i=0;i<buttons.length;i++)
  {
    buttons[i]=new JButton("Button "+(i+1));
    buttonPanel.add(buttons[i]);
  }
  setLayout(new BorderLayout());
  add(buttonPanel,BorderLayout.SOUTH);
  }
    public static void main(String s[])
    {
        JFrame f = new JFrame("JPanel Test");
        f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        JApplet applet = new JPaneltest();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(545,400));
        f.setVisible(true);
    }
}
