< prev index next >

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

Print this page




 642     }
 643 
 644     /**
 645      * Returns the value of "sun.awt.erasebackgroundonresize" property. Default
 646      * value is {@code false}.
 647      */
 648     public static boolean getSunAwtErasebackgroundonresize() {
 649         return AccessController.doPrivileged(new GetBooleanAction("sun.awt.erasebackgroundonresize"));
 650     }
 651 
 652 
 653     @SuppressWarnings("deprecation")
 654     static final SoftCache fileImgCache = new SoftCache();
 655 
 656     @SuppressWarnings("deprecation")
 657     static final SoftCache urlImgCache = new SoftCache();
 658 
 659     static Image getImageFromHash(Toolkit tk, URL url) {
 660         checkPermissions(url);
 661         synchronized (urlImgCache) {
 662             String key = url.toString();
 663             Image img = (Image)urlImgCache.get(key);
 664             if (img == null) {
 665                 try {
 666                     img = tk.createImage(new URLImageSource(url));
 667                     urlImgCache.put(key, img);
 668                 } catch (Exception e) {
 669                 }
 670             }
 671             return img;
 672         }
 673     }
 674 
 675     static Image getImageFromHash(Toolkit tk,
 676                                                String filename) {
 677         checkPermissions(filename);
 678         synchronized (fileImgCache) {
 679             Image img = (Image)fileImgCache.get(filename);
 680             if (img == null) {
 681                 try {
 682                     img = tk.createImage(new FileImageSource(filename));




 642     }
 643 
 644     /**
 645      * Returns the value of "sun.awt.erasebackgroundonresize" property. Default
 646      * value is {@code false}.
 647      */
 648     public static boolean getSunAwtErasebackgroundonresize() {
 649         return AccessController.doPrivileged(new GetBooleanAction("sun.awt.erasebackgroundonresize"));
 650     }
 651 
 652 
 653     @SuppressWarnings("deprecation")
 654     static final SoftCache fileImgCache = new SoftCache();
 655 
 656     @SuppressWarnings("deprecation")
 657     static final SoftCache urlImgCache = new SoftCache();
 658 
 659     static Image getImageFromHash(Toolkit tk, URL url) {
 660         checkPermissions(url);
 661         synchronized (urlImgCache) {
 662             String key = (url == null) ? null : url.toString();
 663             Image img = (Image)urlImgCache.get(key);
 664             if (img == null) {
 665                 try {
 666                     img = tk.createImage(new URLImageSource(url));
 667                     urlImgCache.put(key, img);
 668                 } catch (Exception e) {
 669                 }
 670             }
 671             return img;
 672         }
 673     }
 674 
 675     static Image getImageFromHash(Toolkit tk,
 676                                                String filename) {
 677         checkPermissions(filename);
 678         synchronized (fileImgCache) {
 679             Image img = (Image)fileImgCache.get(filename);
 680             if (img == null) {
 681                 try {
 682                     img = tk.createImage(new FileImageSource(filename));


< prev index next >