src/share/classes/java/awt/SystemTray.java

Print this page




 473             changeSupport = new PropertyChangeSupport(this);
 474             AppContext.getAppContext().put(SystemTray.class, changeSupport);
 475         }
 476         return changeSupport;
 477     }
 478 
 479     synchronized void addNotify() {
 480         if (peer == null) {
 481             Toolkit toolkit = Toolkit.getDefaultToolkit();
 482             if (toolkit instanceof SunToolkit) {
 483                 peer = ((SunToolkit)Toolkit.getDefaultToolkit()).createSystemTray(this);
 484             } else if (toolkit instanceof HeadlessToolkit) {
 485                 peer = ((HeadlessToolkit)Toolkit.getDefaultToolkit()).createSystemTray(this);
 486             }
 487         }
 488     }
 489 
 490     static void checkSystemTrayAllowed() {
 491         SecurityManager security = System.getSecurityManager();
 492         if (security != null) {
 493             security.checkPermission(SecurityConstants.ACCESS_SYSTEM_TRAY_PERMISSION);
 494         }
 495     }
 496 
 497     private static void initializeSystemTrayIfNeeded() {
 498         synchronized (SystemTray.class) {
 499             if (systemTray == null) {
 500                 systemTray = new SystemTray();
 501             }
 502         }
 503     }
 504 }


 473             changeSupport = new PropertyChangeSupport(this);
 474             AppContext.getAppContext().put(SystemTray.class, changeSupport);
 475         }
 476         return changeSupport;
 477     }
 478 
 479     synchronized void addNotify() {
 480         if (peer == null) {
 481             Toolkit toolkit = Toolkit.getDefaultToolkit();
 482             if (toolkit instanceof SunToolkit) {
 483                 peer = ((SunToolkit)Toolkit.getDefaultToolkit()).createSystemTray(this);
 484             } else if (toolkit instanceof HeadlessToolkit) {
 485                 peer = ((HeadlessToolkit)Toolkit.getDefaultToolkit()).createSystemTray(this);
 486             }
 487         }
 488     }
 489 
 490     static void checkSystemTrayAllowed() {
 491         SecurityManager security = System.getSecurityManager();
 492         if (security != null) {
 493             security.checkPermission(SecurityConstants.AWT.ACCESS_SYSTEM_TRAY_PERMISSION);
 494         }
 495     }
 496 
 497     private static void initializeSystemTrayIfNeeded() {
 498         synchronized (SystemTray.class) {
 499             if (systemTray == null) {
 500                 systemTray = new SystemTray();
 501             }
 502         }
 503     }
 504 }