< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java

Print this page




 340     }
 341 
 342 
 343     /**
 344      * Gets Aqua icon used in message dialog.
 345      */
 346     private static Icon getIconForMessageType(String messageType) {
 347         if (messageType.equals("ERROR")) {
 348             return UIManager.getIcon("OptionPane.errorIcon");
 349         } else if (messageType.equals("WARNING")) {
 350             return UIManager.getIcon("OptionPane.warningIcon");
 351         } else {
 352             // this is just an application icon
 353             return UIManager.getIcon("OptionPane.informationIcon");
 354         }
 355     }
 356 
 357     class IconObserver implements ImageObserver {
 358         @Override
 359         public boolean imageUpdate(Image image, int flags, int x, int y, int width, int height) {
 360             if (image != target.getImage()) // if the image has been changed
 361             {
 362                 return false;
 363             }
 364             if ((flags & (ImageObserver.FRAMEBITS | ImageObserver.ALLBITS |
 365                           ImageObserver.WIDTH | ImageObserver.HEIGHT)) != 0)
 366             {
 367                 SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
 368                             public void run() {
 369                                 updateNativeImage(image);
 370                             }
 371                         });
 372             }
 373             return (flags & ImageObserver.ALLBITS) == 0;
 374         }
 375     }
 376 }
 377 


 340     }
 341 
 342 
 343     /**
 344      * Gets Aqua icon used in message dialog.
 345      */
 346     private static Icon getIconForMessageType(String messageType) {
 347         if (messageType.equals("ERROR")) {
 348             return UIManager.getIcon("OptionPane.errorIcon");
 349         } else if (messageType.equals("WARNING")) {
 350             return UIManager.getIcon("OptionPane.warningIcon");
 351         } else {
 352             // this is just an application icon
 353             return UIManager.getIcon("OptionPane.informationIcon");
 354         }
 355     }
 356 
 357     class IconObserver implements ImageObserver {
 358         @Override
 359         public boolean imageUpdate(Image image, int flags, int x, int y, int width, int height) {
 360             if (target == null || image != target.getImage()) //if the image has been changed
 361             {
 362                 return false;
 363             }
 364             if ((flags & (ImageObserver.FRAMEBITS | ImageObserver.ALLBITS |
 365                           ImageObserver.WIDTH | ImageObserver.HEIGHT)) != 0)
 366             {
 367                 SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
 368                             public void run() {
 369                                 updateNativeImage(image);
 370                             }
 371                         });
 372             }
 373             return (flags & ImageObserver.ALLBITS) == 0;
 374         }
 375     }
 376 }
 377 
< prev index next >