/* ** PanelExample sample applet ** ** by (c) Copyright 2001 Simon Huggins ** ** For demonstration purposes only. ** ** You may use this applet on your web site, but it cannot be ** sold in either its original or altered state. ** This original notice must be included in all versions of ** the applet distributed, even if altered. ** ** The author accepts no liability for any difficulties or loss ** arising from use of this applet. It is primarily intended for ** demonstration purposes. ** ** Change History ** ~~~~~~~~~~~~~~ ** 07-Oct-2001 v1.0 Release version */ /* ** Import section - tells the compiler where to look for different classes ** used within this file */ import javax.swing.*; import java.awt.*; /* ** Defines a class called PanelExample which takes the basic JApplet ** class as a template, and adds to it to create our Applet. */ public class PanelExample extends JApplet { /* ** Initialize the applet - i.e. set up any values before processing begins */ public void init() { getContentPane().setLayout(new BorderLayout()); JPanel panel = new JPanel(new GridLayout(2,3)); getContentPane().add(new JButton("BorderLayout.NORTH" ), BorderLayout.NORTH ); getContentPane().add(new JButton("BorderLayout.SOUTH" ), BorderLayout.SOUTH ); getContentPane().add(new JButton("BorderLayout.EAST" ), BorderLayout.EAST ); getContentPane().add(new JButton("BorderLayout.WEST" ), BorderLayout.WEST ); getContentPane().add(panel, BorderLayout.CENTER); for (int i=0;i<(2*3);i++) panel.add(new JButton("Button "+Integer.toString(i))); } }