src/windows/classes/sun/awt/windows/WEmbeddedFrame.java

Print this page

        

@@ -25,18 +25,16 @@
 
 package sun.awt.windows;
 
 import sun.awt.*;
 import java.awt.*;
-import java.awt.event.*;
 import java.awt.peer.ComponentPeer;
-import java.util.*;
-import java.awt.color.*;
 import java.awt.image.*;
 import sun.awt.image.ByteInterleavedRaster;
 import sun.security.action.GetPropertyAction;
-import java.lang.reflect.*;
+import java.security.PrivilegedAction;
+import  java.security.AccessController;
 
 public class WEmbeddedFrame extends EmbeddedFrame {
 
     static {
         initIDs();

@@ -50,12 +48,12 @@
     private int imgHgt = 0;
 
     private static int pScale = 0;
     private static final int MAX_BAND_SIZE = (1024*30);
 
-    private static String printScale = (String) java.security.AccessController
-       .doPrivileged(new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
+    private static String printScale = AccessController.doPrivileged(
+        new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
 
     public WEmbeddedFrame() {
         this((long)0);
     }
 

@@ -73,10 +71,11 @@
             addNotify();
             show();
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         if (getPeer() == null) {
             WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit();
             setPeer(toolkit.createEmbeddedFrame(this));
         }

@@ -132,12 +131,12 @@
                 return;
             }
 
             bandHeight = Math.min(MAX_BAND_SIZE/bandWidth, frameHeight);
 
-            imgWid = (int)(bandWidth * xscale);
-            imgHgt = (int)(bandHeight * yscale);
+            imgWid = bandWidth * xscale;
+            imgHgt = bandHeight * yscale;
             bandImage = new BufferedImage(imgWid, imgHgt,
                                           BufferedImage.TYPE_3BYTE_BGR);
         }
 
         Graphics clearGraphics = bandImage.getGraphics();

@@ -157,11 +156,11 @@
             int currBandHeight = bandHeight;
             int currImgHeight = imgHgt;
             if ((bandTop+bandHeight) > frameHeight) {
                 // last band
                 currBandHeight = frameHeight - bandTop;
-                currImgHeight = (int)(currBandHeight*yscale);
+                currImgHeight = currBandHeight*yscale;
 
                 // multiply by 3 because the image is a 3 byte BGR
                 imageOffset = imgWid*(imgHgt-currImgHeight)*3;
             }
 

@@ -177,13 +176,13 @@
         if (pScale != 0)
             return pScale;
         if (printScale == null) {
             // if no system property is specified,
             // check for environment setting
-            printScale = (String) java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
-                    public Object run() {
+            printScale = AccessController.doPrivileged(
+                new PrivilegedAction<String>() {
+                    public String run() {
                         return System.getenv("JAVA2D_PLUGIN_PRINT_SCALE");
                     }
                 }
             );
         }

@@ -224,10 +223,11 @@
      *     DO NOT INVOKE CLIENT CODE ON THIS THREAD!
      */
     public void activateEmbeddingTopLevel() {
     }
 
+    @SuppressWarnings("deprecation")
     public void synthesizeWindowActivation(final boolean doActivate) {
         if (!doActivate || EventQueue.isDispatchThread()) {
             ((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(doActivate);
         } else {
             // To avoid focus concurrence b/w IE and EmbeddedFrame