src/share/classes/java/awt/SystemTray.java
Print this page
*** 257,267 ****
}
TrayIcon[] oldArray = null, newArray = null;
Vector<TrayIcon> icons = null;
synchronized (this) {
oldArray = systemTray.getTrayIcons();
! icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
if (icons == null) {
icons = new Vector<TrayIcon>(3);
AppContext.getAppContext().put(TrayIcon.class, icons);
} else if (icons.contains(trayIcon)) {
--- 257,269 ----
}
TrayIcon[] oldArray = null, newArray = null;
Vector<TrayIcon> icons = null;
synchronized (this) {
oldArray = systemTray.getTrayIcons();
! @SuppressWarnings("unchecked")
! Vector<TrayIcon> tmp = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
! icons = tmp;
if (icons == null) {
icons = new Vector<TrayIcon>(3);
AppContext.getAppContext().put(TrayIcon.class, icons);
} else if (icons.contains(trayIcon)) {
*** 302,311 ****
--- 304,314 ----
return;
}
TrayIcon[] oldArray = null, newArray = null;
synchronized (this) {
oldArray = systemTray.getTrayIcons();
+ @SuppressWarnings("unchecked")
Vector<TrayIcon> icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
// TrayIcon with no peer is not contained in the array.
if (icons == null || !icons.remove(trayIcon)) {
return;
}
*** 333,342 ****
--- 336,346 ----
* empty array if none has been added
* @see #add(TrayIcon)
* @see TrayIcon
*/
public TrayIcon[] getTrayIcons() {
+ @SuppressWarnings("unchecked")
Vector<TrayIcon> icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
if (icons != null) {
return icons.toArray(new TrayIcon[icons.size()]);
}
return EMPTY_TRAY_ARRAY;