src/share/classes/sun/awt/EmbeddedFrame.java

Print this page


   1 /*
   2  * Copyright (c) 1996, 2010, 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
  23  * questions.
  24  */
  25 
  26 package sun.awt;
  27 
  28 import java.awt.*;
  29 import java.awt.event.*;
  30 import java.awt.image.*;
  31 import java.awt.peer.*;
  32 import java.beans.PropertyChangeListener;
  33 import java.beans.PropertyChangeEvent;
  34 import java.util.Set;
  35 import java.awt.AWTKeyStroke;
  36 import java.applet.Applet;
  37 import javax.tools.annotation.GenerateNativeHeader;
  38 import sun.applet.AppletPanel;
  39 
  40 /**
  41  * A generic container used for embedding Java components, usually applets.
  42  * An EmbeddedFrame has two related uses:
  43  *
  44  * . Within a Java-based application, an EmbeddedFrame serves as a sort of
  45  *   firewall, preventing the contained components or applets from using
  46  *   getParent() to find parent components, such as menubars.
  47  *
  48  * . Within a C-based application, an EmbeddedFrame contains a window handle
  49  *   which was created by the application, which serves as the top-level
  50  *   Java window.  EmbeddedFrames created for this purpose are passed-in a
  51  *   handle of an existing window created by the application.  The window
  52  *   handle should be of the appropriate native type for a specific
  53  *   platform, as stored in the pData field of the ComponentPeer.
  54  *
  55  * @author      Thomas Ball
  56  */
  57 /* No native methods here, but the constants are needed in the supporting JNI code */
  58 @GenerateNativeHeader
  59 public abstract class EmbeddedFrame extends Frame
  60                           implements KeyEventDispatcher, PropertyChangeListener {
  61 
  62     private boolean isCursorAllowed = true;
  63     private boolean supportsXEmbed = false;
  64     private KeyboardFocusManager appletKFM;
  65     // JDK 1.1 compatibility
  66     private static final long serialVersionUID = 2967042741780317130L;
  67 
  68     /*
  69      * The constants define focus traversal directions.
  70      * Use them in {@code traverseIn}, {@code traverseOut} methods.
  71      */
  72     protected static final boolean FORWARD = true;
  73     protected static final boolean BACKWARD = false;
  74 
  75     public boolean supportsXEmbed() {
  76         return supportsXEmbed && SunToolkit.needsXEmbed();
  77     }
  78 


   1 /*
   2  * Copyright (c) 1996, 2013, 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
  23  * questions.
  24  */
  25 
  26 package sun.awt;
  27 
  28 import java.awt.*;
  29 import java.awt.event.*;
  30 import java.awt.image.*;
  31 import java.awt.peer.*;
  32 import java.beans.PropertyChangeListener;
  33 import java.beans.PropertyChangeEvent;
  34 import java.util.Set;
  35 import java.awt.AWTKeyStroke;
  36 import java.applet.Applet;

  37 import sun.applet.AppletPanel;
  38 
  39 /**
  40  * A generic container used for embedding Java components, usually applets.
  41  * An EmbeddedFrame has two related uses:
  42  *
  43  * . Within a Java-based application, an EmbeddedFrame serves as a sort of
  44  *   firewall, preventing the contained components or applets from using
  45  *   getParent() to find parent components, such as menubars.
  46  *
  47  * . Within a C-based application, an EmbeddedFrame contains a window handle
  48  *   which was created by the application, which serves as the top-level
  49  *   Java window.  EmbeddedFrames created for this purpose are passed-in a
  50  *   handle of an existing window created by the application.  The window
  51  *   handle should be of the appropriate native type for a specific
  52  *   platform, as stored in the pData field of the ComponentPeer.
  53  *
  54  * @author      Thomas Ball
  55  */


  56 public abstract class EmbeddedFrame extends Frame
  57                           implements KeyEventDispatcher, PropertyChangeListener {
  58 
  59     private boolean isCursorAllowed = true;
  60     private boolean supportsXEmbed = false;
  61     private KeyboardFocusManager appletKFM;
  62     // JDK 1.1 compatibility
  63     private static final long serialVersionUID = 2967042741780317130L;
  64 
  65     /*
  66      * The constants define focus traversal directions.
  67      * Use them in {@code traverseIn}, {@code traverseOut} methods.
  68      */
  69     protected static final boolean FORWARD = true;
  70     protected static final boolean BACKWARD = false;
  71 
  72     public boolean supportsXEmbed() {
  73         return supportsXEmbed && SunToolkit.needsXEmbed();
  74     }
  75