// www.ShaneReustle.com - panel scriptimport java.awt.*;import java.applet.Applet;import java.awt.event.*;public class shane extends Applet implements ActionListener { Panel cardPanel, panLogin, panCreate; //Main Panel, Sub Panel 1, Sub Panel 2 CardLayout ourLayout; //The card layout object Button btnSubmitLogin, btnCreateAccount; //The buttons being used on the login panel public void init(){ ourLayout = new CardLayout(); //Defines the type of layout to use. cardPanel = new Panel(); //Create cardPanel which is the panel that will contain the other panels cardPanel.setLayout(ourLayout); //Set cardPanel's layout to be our Card Layout panLogin = new Panel(); //Create the login panel object panCreate = new Panel(); //Create the create panel object this.setLayout(new BorderLayout()); //Make setLayout for applet to be BorderLayout this.add(cardPanel, BorderLayout.CENTER); //Put the main container panel in the center cardPanel.add(panLogin, "panLogin"); //Adds the login sub panel to the main panel. 1) the object , 2) the identifyer cardPanel.add(panCreate, "panCreate"); //Adds the create sub panel to the main panel. 1) the object , 2) the identifyer ourLayout.show(cardPanel, "panLogin"); //Defines the default panel // START - Login Panel Button btnSubmitLogin = new Button("Login"); //Create the login button object Button btnCreateAccount = new Button("Create Account"); //Create the new account button object panLogin.add(btnSubmitLogin); //Add the login button to the login panel panLogin.add(btnSubmitLogin); //Add the new account button to the login panel TextField txtUsername = new TextField("A Textfield!", 10); //Create the username field panLogin.add(txtUsername); //Add the username field to the login panel // END - Login Panel // START - Create Panel // END - Create Panel } public void paint(Graphics g){ // Paint a pretty picture! } public void actionPerformed(ActionEvent e){ // Check for button clicks! }}