home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / awt / Panel.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  1.9 KB  |  72 lines

  1. /*
  2.  * @(#)Panel.java    1.18 98/03/18
  3.  *
  4.  * Copyright 1995-1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14. package java.awt;
  15.  
  16. import java.awt.peer.PanelPeer;
  17.  
  18. /**
  19.  * <code>Panel</code> is the simplest container class. A panel   
  20.  * provides space in which an application can attach any other 
  21.  * component, including other panels. 
  22.  * <p>
  23.  * The default layout manager for a panel is the 
  24.  * <code>FlowLayout</code> layout manager.
  25.  *
  26.  * @version     1.18, 03/18/98
  27.  * @author     Sami Shaio
  28.  * @see     java.awt.FlowLayout
  29.  * @since   JDK1.0
  30.  */
  31. public class Panel extends Container {
  32.     final static LayoutManager panelLayout = new FlowLayout();
  33.  
  34.     private static final String base = "panel";
  35.     private static int nameCounter = 0;
  36.  
  37.     /*
  38.      * JDK 1.1 serialVersionUID 
  39.      */
  40.      private static final long serialVersionUID = -2728009084054400034L;
  41.  
  42.     /**
  43.      * Creates a new panel using the default layout manager. 
  44.      * The default layout manager for all panels is the 
  45.      * <code>FlowLayout</code> class.
  46.      */
  47.     public Panel() {
  48.     this(panelLayout);
  49.     }
  50.  
  51.     /**
  52.      * Creates a new panel with the specified layout manager.
  53.      * @param layout the layout manager for this panel.
  54.      * @since JDK1.1
  55.      */
  56.     public Panel(LayoutManager layout) {
  57.         this.name = base + nameCounter++;
  58.     setLayout(layout);
  59.     }
  60.  
  61.     /**
  62.      * Creates the Panel's peer.  The peer allows you to modify the
  63.      * appearance of the panel without changing its functionality.
  64.      */
  65.  
  66.     public void addNotify() {
  67.     peer = getToolkit().createPanel(this);
  68.     super.addNotify();
  69.     }
  70.  
  71. }
  72.