2362N/A * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 2362N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 0N/A * An extended version of <code>java.applet.Applet</code> that adds support for 0N/A * You can find task-oriented documentation about using <code>JApplet</code> 0N/A * in <em>The Java Tutorial</em>, 0N/A * The <code>JApplet</code> class is slightly incompatible with 0N/A * <code>java.applet.Applet</code>. <code>JApplet</code> contains a 0N/A * <code>JRootPane</code> as its only child. The <code>contentPane</code> 0N/A * should be the parent of any children of the <code>JApplet</code>. 0N/A * As a convenience <code>add</code> and its variants, <code>remove</code> and 0N/A * <code>setLayout</code> have been overridden to forward to the 0N/A * <code>contentPane</code> as necessary. This means you can write: 0N/A * applet.add(child); 0N/A * And the child will be added to the <code>contentPane</code>. 0N/A * The <code>contentPane</code> will always be non-<code>null</code>. 0N/A * Attempting to set it to <code>null</code> will cause the 0N/A * <code>JApplet</code> to throw an exception. The default 0N/A * <code>contentPane</code> will have a <code>BorderLayout</code> 0N/A * manager set on it. 0N/A * Refer to {@link javax.swing.RootPaneContainer} 0N/A * for details on adding, removing and setting the <code>LayoutManager</code> 0N/A * of a <code>JApplet</code>. 0N/A * Please see the <code>JRootPane</code> documentation for a 0N/A * complete description of the <code>contentPane</code>, <code>glassPane</code>, 0N/A * and <code>layeredPane</code> properties. 0N/A * <strong>Warning:</strong> Swing is not thread safe. For more 0N/A * information see <a 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * @see javax.swing.RootPaneContainer 0N/A * attribute: isContainer true 0N/A * attribute: containerDelegate getContentPane 0N/A * description: Swing's Applet subclass. 0N/A * @author Arnaud Weber 0N/A * If true then calls to <code>add</code> and <code>setLayout</code> 0N/A * will be forwarded to the <code>contentPane</code>. This is initially 0N/A * false, but is set to true when the <code>JApplet</code> is constructed. 0N/A * @see #isRootPaneCheckingEnabled 0N/A * @see #setRootPaneCheckingEnabled 0N/A * @see javax.swing.RootPaneContainer 0N/A * The <code>TransferHandler</code> for this applet. 0N/A * Creates a swing applet instance. 0N/A * This constructor sets the component's locale property to the value 0N/A * returned by <code>JComponent.getDefaultLocale</code>. 0N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() * @see java.awt.GraphicsEnvironment#isHeadless * @see JComponent#getDefaultLocale // Check the timerQ and restart if necessary. /* Workaround for bug 4155072. The shared double buffer image * may hang on to a reference to this applet; unfortunately * Image.getGraphics() will continue to call JApplet.getForeground() * and getBackground() even after this applet has been destroyed. * So we ensure that these properties are non-null here. /** Called by the constructor methods to create the default rootPane. */ // NOTE: this uses setOpaque vs LookAndFeel.installProperty as there // is NO reason for the RootPane not to be opaque. For painting to // work the contentPane must be opaque, therefor the RootPane can * Sets the {@code transferHandler} property, which is a mechanism to * support transfer of data into this component. Use {@code null} * if the component does not support data transfer operations. * If the system property {@code suppressSwingDropSupport} is {@code false} * (the default) and the current drop target on this component is either * {@code null} or not a user-set drop target, this method will change the * drop target as follows: If {@code newHandler} is {@code null} it will * clear the drop target. If not {@code null} it will install a new * Note: When used with {@code JApplet}, {@code TransferHandler} only * provides data import capability, as the data export related methods * are currently typed to {@code JComponent}. * How to Use Drag and Drop and Data Transfer</a>, a section in * <em>The Java Tutorial</em>, for more information. * @param newHandler the new {@code TransferHandler} * @see #getTransferHandler * @see java.awt.Component#setDropTarget * description: Mechanism for transfer of data into the component * Gets the <code>transferHandler</code> property. * @return the value of the <code>transferHandler</code> property * @see #setTransferHandler * Just calls <code>paint(g)</code>. This method was overridden to * prevent an unnecessary call to clear the background. * Sets the menubar for this applet. * @param menuBar the menubar being placed in the applet * description: The menubar for accessing pulldown menus from this applet. * Returns the menubar set on this applet. * Returns whether calls to <code>add</code> and * <code>setLayout</code> are forwarded to the <code>contentPane</code>. * @return true if <code>add</code> and <code>setLayout</code> * are fowarded; false otherwise * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer * Sets whether calls to <code>add</code> and * <code>setLayout</code> are forwarded to the <code>contentPane</code>. * @param enabled true if <code>add</code> and <code>setLayout</code> * are forwarded, false if they should operate directly on the * @see #isRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer * description: Whether the add and setLayout methods are forwarded * Adds the specified child <code>Component</code>. * This method is overridden to conditionally forward calls to the * <code>contentPane</code>. * By default, children are added to the <code>contentPane</code> instead * of the frame, refer to {@link javax.swing.RootPaneContainer} for * @param comp the component to be enhanced * @param constraints the constraints to be respected * @exception IllegalArgumentException if <code>index</code> is invalid * @exception IllegalArgumentException if adding the container's parent * @exception IllegalArgumentException if adding a window to a container * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer * Removes the specified component from the container. If * <code>comp</code> is not the <code>rootPane</code>, this will forward * the call to the <code>contentPane</code>. This will do nothing if * <code>comp</code> is not a child of the <code>JFrame</code> or * <code>contentPane</code>. * @param comp the component to be removed * @throws NullPointerException if <code>comp</code> is null * @see javax.swing.RootPaneContainer * Sets the <code>LayoutManager</code>. * Overridden to conditionally forward the call to the * <code>contentPane</code>. * Refer to {@link javax.swing.RootPaneContainer} for * @param manager the <code>LayoutManager</code> * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer * Returns the rootPane object for this applet. * @see RootPaneContainer#getRootPane * Sets the rootPane property. This method is called by the constructor. * @param root the rootPane object for this applet * description: the RootPane object for this applet. * Returns the contentPane object for this applet. * @see RootPaneContainer#getContentPane * Sets the contentPane property. This method is called by the constructor. * @param contentPane the contentPane object for this applet * @exception java.awt.IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @see RootPaneContainer#setContentPane * description: The client area of the applet where child * components are normally inserted. * Returns the layeredPane object for this applet. * @exception java.awt.IllegalComponentStateException (a runtime * exception) if the layered pane parameter is null * @see RootPaneContainer#getLayeredPane * Sets the layeredPane property. This method is called by the constructor. * @param layeredPane the layeredPane object for this applet * @see RootPaneContainer#setLayeredPane * description: The pane which holds the various applet layers. * Returns the glassPane object for this applet. * @see RootPaneContainer#getGlassPane * Sets the glassPane property. * This method is called by the constructor. * @param glassPane the glassPane object for this applet * @see RootPaneContainer#setGlassPane * description: A transparent pane used for menu rendering. * Repaints the specified rectangle of this component within * <code>time</code> milliseconds. Refer to <code>RepaintManager</code> * for details on how the repaint is handled. * @param time maximum time in milliseconds before update * @param x the <i>x</i> coordinate * @param y the <i>y</i> coordinate * @param height the height * Returns a string representation of this JApplet. This method * is intended to be used only for debugging purposes, and the * content and format of the returned string may vary between * implementations. The returned string may be empty but may not * @return a string representation of this JApplet. * Gets the AccessibleContext associated with this JApplet. * For JApplets, the AccessibleContext takes the form of an * A new AccessibleJApplet instance is created if necessary. * @return an AccessibleJApplet that serves as the * AccessibleContext of this JApplet * This class implements accessibility support for the * <code>JApplet</code> class. // everything moved to new parent, AccessibleApplet