--- a/jdk/src/share/classes/java/awt/SystemTray.java Thu May 29 13:48:51 2008 +0400
+++ b/jdk/src/share/classes/java/awt/SystemTray.java Wed Jun 04 12:32:05 2008 +0400
@@ -125,6 +125,8 @@
transient private SystemTrayPeer peer;
+ private static final TrayIcon[] EMPTY_TRAY_ARRAY = new TrayIcon[0];
+
/**
* Private <code>SystemTray</code> constructor.
*
@@ -203,13 +205,12 @@
public static boolean isSupported() {
initializeSystemTrayIfNeeded();
- if (Toolkit.getDefaultToolkit() instanceof SunToolkit) {
-
- return ((SunToolkit)Toolkit.getDefaultToolkit()).isTraySupported();
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
- } else if (Toolkit.getDefaultToolkit() instanceof HeadlessToolkit) {
-
- return ((HeadlessToolkit)Toolkit.getDefaultToolkit()).isTraySupported();
+ if (toolkit instanceof SunToolkit) {
+ return ((SunToolkit)toolkit).isTraySupported();
+ } else if (toolkit instanceof HeadlessToolkit) {
+ return ((HeadlessToolkit)toolkit).isTraySupported();
}
return false;
}
@@ -323,7 +324,7 @@
if (icons != null) {
return (TrayIcon[])icons.toArray(new TrayIcon[icons.size()]);
}
- return new TrayIcon[0];
+ return EMPTY_TRAY_ARRAY;
}
/**