src/java.desktop/share/classes/java/awt/Panel.java

Print this page


   1 /*
   2  * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  66     }
  67 
  68     /**
  69      * Construct a name for this component.  Called by getName() when the
  70      * name is null.
  71      */
  72     String constructComponentName() {
  73         synchronized (Panel.class) {
  74             return base + nameCounter++;
  75         }
  76     }
  77 
  78     /**
  79      * Creates the Panel's peer.  The peer allows you to modify the
  80      * appearance of the panel without changing its functionality.
  81      */
  82 
  83     public void addNotify() {
  84         synchronized (getTreeLock()) {
  85             if (peer == null)
  86                 peer = getToolkit().createPanel(this);
  87             super.addNotify();
  88         }
  89     }
  90 
  91 /////////////////
  92 // Accessibility support
  93 ////////////////
  94 
  95     /**
  96      * Gets the AccessibleContext associated with this Panel.
  97      * For panels, the AccessibleContext takes the form of an
  98      * AccessibleAWTPanel.
  99      * A new AccessibleAWTPanel instance is created if necessary.
 100      *
 101      * @return an AccessibleAWTPanel that serves as the
 102      *         AccessibleContext of this Panel
 103      * @since 1.3
 104      */
 105     public AccessibleContext getAccessibleContext() {
 106         if (accessibleContext == null) {


   1 /*
   2  * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  66     }
  67 
  68     /**
  69      * Construct a name for this component.  Called by getName() when the
  70      * name is null.
  71      */
  72     String constructComponentName() {
  73         synchronized (Panel.class) {
  74             return base + nameCounter++;
  75         }
  76     }
  77 
  78     /**
  79      * Creates the Panel's peer.  The peer allows you to modify the
  80      * appearance of the panel without changing its functionality.
  81      */
  82 
  83     public void addNotify() {
  84         synchronized (getTreeLock()) {
  85             if (peer == null)
  86                 peer = getComponentFactory().createPanel(this);
  87             super.addNotify();
  88         }
  89     }
  90 
  91 /////////////////
  92 // Accessibility support
  93 ////////////////
  94 
  95     /**
  96      * Gets the AccessibleContext associated with this Panel.
  97      * For panels, the AccessibleContext takes the form of an
  98      * AccessibleAWTPanel.
  99      * A new AccessibleAWTPanel instance is created if necessary.
 100      *
 101      * @return an AccessibleAWTPanel that serves as the
 102      *         AccessibleContext of this Panel
 103      * @since 1.3
 104      */
 105     public AccessibleContext getAccessibleContext() {
 106         if (accessibleContext == null) {