import java.awt.*;import javax.swing.*;/** This class is used to demo the use of a JPanel. An    An instance has labels in the north and south and    a JPanel with four buttons in the center.  */public class PanelDemo extends JFrame { JPanel p= new JPanel();  /** Constructor: an invisible frame with title t, two labels in the      north and south and a JPanel of 4 buttons in the center */ public PanelDemo(String t) {  super(t);    p.add(new JButton("0"));  p.add(new JButton("1"));  p.add(new JButton("2"));  p.add(new JButton("3"));    Container cp= getContentPane();  cp.add(new JLabel("north"),BorderLayout.NORTH);  cp.add(new JLabel("south"),BorderLayout.EAST);  cp.add(p,BorderLayout.CENTER);     pack(); }  public static void main(String[] args) {  PanelDemo pd= new PanelDemo("demo JPanel");  pd.setVisible(true); }}