< prev index next >

src/java.desktop/share/classes/javax/swing/JApplet.java

Print this page

        

*** 36,78 **** import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; /** ! * An extended version of <code>java.applet.Applet</code> that adds support for * the JFC/Swing component architecture. ! * You can find task-oriented documentation about using <code>JApplet</code> * in <em>The Java Tutorial</em>, * in the section * <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/applet.html">How to Make Applets</a>. * <p> ! * The <code>JApplet</code> class is slightly incompatible with ! * <code>java.applet.Applet</code>. <code>JApplet</code> contains a ! * <code>JRootPane</code> as its only child. The <code>contentPane</code> ! * should be the parent of any children of the <code>JApplet</code>. * As a convenience, the {@code add}, {@code remove}, and {@code setLayout} * methods of this class are overridden, so that they delegate calls * to the corresponding methods of the {@code ContentPane}. * For example, you can add a child component to an applet as follows: * <pre> * applet.add(child); * </pre> * ! * And the child will be added to the <code>contentPane</code>. ! * The <code>contentPane</code> will always be non-<code>null</code>. ! * Attempting to set it to <code>null</code> will cause the ! * <code>JApplet</code> to throw an exception. The default ! * <code>contentPane</code> will have a <code>BorderLayout</code> * manager set on it. * Refer to {@link javax.swing.RootPaneContainer} ! * for details on adding, removing and setting the <code>LayoutManager</code> ! * of a <code>JApplet</code>. * <p> ! * Please see the <code>JRootPane</code> documentation for a ! * complete description of the <code>contentPane</code>, <code>glassPane</code>, ! * and <code>layeredPane</code> properties. * <p> * <strong>Warning:</strong> Swing is not thread safe. For more * information see <a * href="package-summary.html#threading">Swing's Threading * Policy</a>. --- 36,78 ---- import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; /** ! * An extended version of {@code java.applet.Applet} that adds support for * the JFC/Swing component architecture. ! * You can find task-oriented documentation about using {@code JApplet} * in <em>The Java Tutorial</em>, * in the section * <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/applet.html">How to Make Applets</a>. * <p> ! * The {@code JApplet} class is slightly incompatible with ! * {@code java.applet.Applet}. {@code JApplet} contains a ! * {@code JRootPane} as its only child. The {@code contentPane} ! * should be the parent of any children of the {@code JApplet}. * As a convenience, the {@code add}, {@code remove}, and {@code setLayout} * methods of this class are overridden, so that they delegate calls * to the corresponding methods of the {@code ContentPane}. * For example, you can add a child component to an applet as follows: * <pre> * applet.add(child); * </pre> * ! * And the child will be added to the {@code contentPane}. ! * The {@code contentPane} will always be non-{@code null}. ! * Attempting to set it to {@code null} will cause the ! * {@code JApplet} to throw an exception. The default ! * {@code contentPane} will have a {@code BorderLayout} * manager set on it. * Refer to {@link javax.swing.RootPaneContainer} ! * for details on adding, removing and setting the {@code LayoutManager} ! * of a {@code JApplet}. * <p> ! * Please see the {@code JRootPane} documentation for a ! * complete description of the {@code contentPane}, {@code glassPane}, ! * and {@code layeredPane} properties. * <p> * <strong>Warning:</strong> Swing is not thread safe. For more * information see <a * href="package-summary.html#threading">Swing's Threading * Policy</a>.
*** 81,91 **** * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see javax.swing.RootPaneContainer * @beaninfo * attribute: isContainer true --- 81,91 ---- * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @see javax.swing.RootPaneContainer * @beaninfo * attribute: isContainer true
*** 105,134 **** * @see #setRootPane */ protected JRootPane rootPane; /** ! * If true then calls to <code>add</code> and <code>setLayout</code> ! * will be forwarded to the <code>contentPane</code>. This is initially ! * false, but is set to true when the <code>JApplet</code> is constructed. * * @see #isRootPaneCheckingEnabled * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer */ protected boolean rootPaneCheckingEnabled = false; /** ! * The <code>TransferHandler</code> for this applet. */ private TransferHandler transferHandler; /** * Creates a swing applet instance. * <p> * This constructor sets the component's locale property to the value ! * returned by <code>JComponent.getDefaultLocale</code>. * * @exception HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @see JComponent#getDefaultLocale --- 105,134 ---- * @see #setRootPane */ protected JRootPane rootPane; /** ! * If true then calls to {@code add} and {@code setLayout} ! * will be forwarded to the {@code contentPane}. This is initially ! * false, but is set to true when the {@code JApplet} is constructed. * * @see #isRootPaneCheckingEnabled * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer */ protected boolean rootPaneCheckingEnabled = false; /** ! * The {@code TransferHandler} for this applet. */ private TransferHandler transferHandler; /** * Creates a swing applet instance. * <p> * This constructor sets the component's locale property to the value ! * returned by {@code JComponent.getDefaultLocale}. * * @exception HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless * @see JComponent#getDefaultLocale
*** 215,238 **** SwingUtilities.installSwingDropTargetAsNecessary(this, transferHandler); firePropertyChange("transferHandler", oldHandler, newHandler); } /** ! * Gets the <code>transferHandler</code> property. * ! * @return the value of the <code>transferHandler</code> property * * @see TransferHandler * @see #setTransferHandler * @since 1.6 */ public TransferHandler getTransferHandler() { return transferHandler; } /** ! * Just calls <code>paint(g)</code>. This method was overridden to * prevent an unnecessary call to clear the background. */ public void update(Graphics g) { paint(g); } --- 215,238 ---- SwingUtilities.installSwingDropTargetAsNecessary(this, transferHandler); firePropertyChange("transferHandler", oldHandler, newHandler); } /** ! * Gets the {@code transferHandler} property. * ! * @return the value of the {@code transferHandler} property * * @see TransferHandler * @see #setTransferHandler * @since 1.6 */ public TransferHandler getTransferHandler() { return transferHandler; } /** ! * Just calls {@code paint(g)}. This method was overridden to * prevent an unnecessary call to clear the background. */ public void update(Graphics g) { paint(g); }
*** 261,274 **** return getRootPane().getJMenuBar(); } /** ! * 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 forwarded; false otherwise * * @see #addImpl * @see #setLayout * @see #setRootPaneCheckingEnabled --- 261,274 ---- return getRootPane().getJMenuBar(); } /** ! * Returns whether calls to {@code add} and ! * {@code setLayout} are forwarded to the {@code contentPane}. * ! * @return true if {@code add} and {@code setLayout} * are forwarded; false otherwise * * @see #addImpl * @see #setLayout * @see #setRootPaneCheckingEnabled
*** 278,293 **** return rootPaneCheckingEnabled; } /** ! * 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 ! * <code>JApplet</code>. * * @see #addImpl * @see #setLayout * @see #isRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer --- 278,293 ---- return rootPaneCheckingEnabled; } /** ! * Sets whether calls to {@code add} and ! * {@code setLayout} are forwarded to the {@code contentPane}. * ! * @param enabled true if {@code add} and {@code setLayout} * are forwarded, false if they should operate directly on the ! * {@code JApplet}. * * @see #addImpl * @see #setLayout * @see #isRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer
*** 299,319 **** rootPaneCheckingEnabled = enabled; } /** ! * 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 * details. * * @param comp the component to be enhanced * @param constraints the constraints to be respected * @param index the index ! * @exception IllegalArgumentException if <code>index</code> is invalid * @exception IllegalArgumentException if adding the container's parent * to itself * @exception IllegalArgumentException if adding a window to a container * * @see #setRootPaneCheckingEnabled --- 299,319 ---- rootPaneCheckingEnabled = enabled; } /** ! * Adds the specified child {@code Component}. * This method is overridden to conditionally forward calls to the ! * {@code contentPane}. ! * By default, children are added to the {@code contentPane} instead * of the frame, refer to {@link javax.swing.RootPaneContainer} for * details. * * @param comp the component to be enhanced * @param constraints the constraints to be respected * @param index the index ! * @exception IllegalArgumentException if {@code index} is invalid * @exception IllegalArgumentException if adding the container's parent * to itself * @exception IllegalArgumentException if adding a window to a container * * @see #setRootPaneCheckingEnabled
*** 329,345 **** } } /** * 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 #add * @see javax.swing.RootPaneContainer */ public void remove(Component comp) { if (comp == rootPane) { --- 329,345 ---- } } /** * Removes the specified component from the container. If ! * {@code comp} is not the {@code rootPane}, this will forward ! * the call to the {@code contentPane}. This will do nothing if ! * {@code comp} is not a child of the {@code JFrame} or ! * {@code contentPane}. * * @param comp the component to be removed ! * @throws NullPointerException if {@code comp} is null * @see #add * @see javax.swing.RootPaneContainer */ public void remove(Component comp) { if (comp == rootPane) {
*** 349,365 **** } } /** ! * Sets the <code>LayoutManager</code>. * Overridden to conditionally forward the call to the ! * <code>contentPane</code>. * Refer to {@link javax.swing.RootPaneContainer} for * more information. * ! * @param manager the <code>LayoutManager</code> * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer */ public void setLayout(LayoutManager manager) { if(isRootPaneCheckingEnabled()) { --- 349,365 ---- } } /** ! * Sets the {@code LayoutManager}. * Overridden to conditionally forward the call to the ! * {@code contentPane}. * Refer to {@link javax.swing.RootPaneContainer} for * more information. * ! * @param manager the {@code LayoutManager} * @see #setRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer */ public void setLayout(LayoutManager manager) { if(isRootPaneCheckingEnabled()) {
*** 501,511 **** return super.getGraphics(); } /** * 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 --- 501,511 ---- return super.getGraphics(); } /** * Repaints the specified rectangle of this component within ! * {@code time} milliseconds. Refer to {@code RepaintManager} * 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
*** 527,537 **** /** * 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 ! * be <code>null</code>. * * @return a string representation of this JApplet. */ protected String paramString() { String rootPaneString = (rootPane != null ? --- 527,537 ---- /** * 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 ! * be {@code null}. * * @return a string representation of this JApplet. */ protected String paramString() { String rootPaneString = (rootPane != null ?
*** 571,581 **** return accessibleContext; } /** * This class implements accessibility support for the ! * <code>JApplet</code> class. */ protected class AccessibleJApplet extends AccessibleApplet { // everything moved to new parent, AccessibleApplet } } --- 571,581 ---- return accessibleContext; } /** * This class implements accessibility support for the ! * {@code JApplet} class. */ protected class AccessibleJApplet extends AccessibleApplet { // everything moved to new parent, AccessibleApplet } }
< prev index next >