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

Print this page

        

@@ -25,18 +25,16 @@
 
 package sun.awt;
 
 import java.awt.*;
 import java.awt.event.*;
-import java.awt.image.*;
 import java.awt.peer.*;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
 import java.util.Set;
 import java.awt.AWTKeyStroke;
 import java.applet.Applet;
-import sun.applet.AppletPanel;
 
 /**
  * A generic container used for embedding Java components, usually applets.
  * An EmbeddedFrame has two related uses:
  *

@@ -318,36 +316,34 @@
 
     public boolean isResizable() {
         return true;
     }
 
-    @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized (getTreeLock()) {
-            if (getPeer() == null) {
+            if (!isDisplayable()) {
                 setPeer(new NullEmbeddedFramePeer());
             }
             super.addNotify();
         }
     }
 
     // These three functions consitute RFE 4100710. Do not remove.
-    @SuppressWarnings("deprecation")
     public void setCursorAllowed(boolean isCursorAllowed) {
         this.isCursorAllowed = isCursorAllowed;
-        getPeer().updateCursorImmediately();
+        final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
+        peer.updateCursorImmediately();
     }
     public boolean isCursorAllowed() {
         return isCursorAllowed;
     }
     public Cursor getCursor() {
         return (isCursorAllowed)
             ? super.getCursor()
             : Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
     }
 
-    @SuppressWarnings("deprecation")
     protected void setPeer(final ComponentPeer p){
         AWTAccessor.getComponentAccessor().setPeer(EmbeddedFrame.this, p);
     };
 
     /**

@@ -456,13 +452,12 @@
      * @see #setLocationPrivate
      * @see #getLocationPrivate
      * @see #getBoundsPrivate
      * @since 1.5
      */
-    @SuppressWarnings("deprecation")
     protected void setBoundsPrivate(int x, int y, int width, int height) {
-        final FramePeer peer = (FramePeer)getPeer();
+        final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
         if (peer != null) {
             peer.setBoundsPrivate(x, y, width, height);
         }
     }
 

@@ -488,13 +483,12 @@
      * @see #setLocationPrivate
      * @see #getLocationPrivate
      * @see #setBoundsPrivate
      * @since 1.6
      */
-    @SuppressWarnings("deprecation")
     protected Rectangle getBoundsPrivate() {
-        final FramePeer peer = (FramePeer)getPeer();
+        final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
         if (peer != null) {
             return peer.getBoundsPrivate();
         }
         else {
             return getBounds();