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

Print this page

        

@@ -178,10 +178,11 @@
      * Needed to avoid memory leak: we register this EmbeddedFrame as a listener with
      * KeyboardFocusManager of applet's AppContext. We don't want the KFM to keep
      * reference to our EmbeddedFrame forever if the Frame is no longer in use, so we
      * add listeners in show() and remove them in hide().
      */
+    @SuppressWarnings("deprecation")
     public void show() {
         if (appletKFM != null) {
             addTraversingOutListeners(appletKFM);
         }
         super.show();

@@ -191,10 +192,11 @@
      * Needed to avoid memory leak: we register this EmbeddedFrame as a listener with
      * KeyboardFocusManager of applet's AppContext. We don't want the KFM to keep
      * reference to our EmbeddedFrame forever if the Frame is no longer in use, so we
      * add listeners in show() and remove them in hide().
      */
+    @SuppressWarnings("deprecation")
     public void hide() {
         if (appletKFM != null) {
             removeTraversingOutListeners(appletKFM);
         }
         super.hide();

@@ -210,12 +212,12 @@
 
         // We can't guarantee that this is called on the same AppContext as EmbeddedFrame
         // belongs to. That's why we can't use public methods to find current focus cycle
         // root. Instead, we access KFM's private field directly.
         if (currentCycleRoot == null) {
-            currentCycleRoot = (Field)AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+            currentCycleRoot = AccessController.doPrivileged(new PrivilegedAction<Field>() {
+                public Field run() {
                     try {
                         Field unaccessibleRoot = KeyboardFocusManager.class.
                                                      getDeclaredField("currentFocusCycleRoot");
                         if (unaccessibleRoot != null) {
                             unaccessibleRoot.setAccessible(true);

@@ -255,11 +257,11 @@
         if (!getFocusTraversalKeysEnabled() || e.isConsumed()) {
             return false;
         }
 
         AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
-        Set toTest;
+        Set<AWTKeyStroke> toTest;
         Component currentFocused = e.getComponent();
 
         toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
         if (toTest.contains(stroke)) {
             // 6581899: performance improvement for SortingFocusTraversalPolicy

@@ -355,20 +357,22 @@
 
     public boolean isResizable() {
         return true;
     }
 
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized (getTreeLock()) {
             if (getPeer() == null) {
                 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();
     }
     public boolean isCursorAllowed() {

@@ -378,14 +382,15 @@
         return (isCursorAllowed)
             ? super.getCursor()
             : Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
     }
 
+    @SuppressWarnings("deprecation")
     protected  void setPeer(final ComponentPeer p){
         if (fieldPeer == null) {
-            fieldPeer = (Field)AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
+            fieldPeer = AccessController.doPrivileged(new PrivilegedAction<Field>() {
+                public Field run() {
                         try {
                             Field lnkPeer = Component.class.getDeclaredField("peer");
                             if (lnkPeer != null) {
                                 lnkPeer.setAccessible(true);
                             }

@@ -398,11 +403,11 @@
                         return null;
                     }//run
                 });
         }
         try{
-            if (fieldPeer !=null){
+            if (fieldPeer != null){
                 fieldPeer.set(EmbeddedFrame.this, p);
             }
         } catch (IllegalAccessException e) {
             assert false;
         }

@@ -505,10 +510,11 @@
      * @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();
         if (peer != null) {
             peer.setBoundsPrivate(x, y, width, height);
         }

@@ -536,10 +542,11 @@
      * @see #setLocationPrivate
      * @see #getLocationPrivate
      * @see #setBoundsPrivate
      * @since 1.6
      */
+    @SuppressWarnings("deprecation")
     protected Rectangle getBoundsPrivate() {
         final FramePeer peer = (FramePeer)getPeer();
         if (peer != null) {
             return peer.getBoundsPrivate();
         }