home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / Panel.java < prev    next >
Text File  |  1997-10-01  |  2KB  |  81 lines

  1. /*
  2.  * @(#)Panel.java    1.16 97/06/17
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22. package java.awt;
  23.  
  24. import java.awt.peer.PanelPeer;
  25.  
  26. /**
  27.  * <code>Panel</code> is the simplest container class. A panel   
  28.  * provides space in which an application can attach any other 
  29.  * component, including other panels. 
  30.  * <p>
  31.  * The default layout manager for a panel is the 
  32.  * <code>FlowLayout</code> layout manager.
  33.  *
  34.  * @version     1.16, 06/17/97
  35.  * @author     Sami Shaio
  36.  * @see     java.awt.FlowLayout
  37.  * @since   JDK1.0
  38.  */
  39. public class Panel extends Container {
  40.     final static LayoutManager panelLayout = new FlowLayout();
  41.  
  42.     private static final String base = "panel";
  43.     private static int nameCounter = 0;
  44.  
  45.     /*
  46.      * JDK 1.1 serialVersionUID 
  47.      */
  48.      private static final long serialVersionUID = -2728009084054400034L;
  49.  
  50.     /**
  51.      * Creates a new panel using the default layout manager. 
  52.      * The default layout manager for all panels is the 
  53.      * <code>FlowLayout</code> class.
  54.      * @since       JDK1.0
  55.      */
  56.     public Panel() {
  57.     this(panelLayout);
  58.     }
  59.  
  60.     /**
  61.      * Creates a new panel with the specified layout manager.
  62.      * @param layout the layout manager for this panel.
  63.      * @since JDK1.1
  64.      */
  65.     public Panel(LayoutManager layout) {
  66.         this.name = base + nameCounter++;
  67.     setLayout(layout);
  68.     }
  69.  
  70.     /**
  71.      * Creates the Panel's peer.  The peer allows you to modify the
  72.      * appearance of the panel without changing its functionality.
  73.      */
  74.  
  75.     public void addNotify() {
  76.     peer = getToolkit().createPanel(this);
  77.     super.addNotify();
  78.     }
  79.  
  80. }
  81.