src/java.desktop/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 35,44 ****
--- 35,46 ----
import java.awt.image.BufferedImage;
import java.awt.peer.TrayIconPeer;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+ import static sun.awt.AWTAccessor.*;
+
public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
private TrayIcon target;
private PopupMenu popup;
private JDialog messageDialog;
private DialogEventHandler handler;
*** 66,84 ****
//if no one else is creating the peer.
checkAndCreatePopupPeer();
updateImage();
}
- @SuppressWarnings("deprecation")
private CPopupMenu checkAndCreatePopupPeer() {
CPopupMenu menuPeer = null;
if (popup != null) {
try {
! menuPeer = (CPopupMenu)popup.getPeer();
if (menuPeer == null) {
popup.addNotify();
! menuPeer = (CPopupMenu)popup.getPeer();
}
} catch (Exception e) {
e.printStackTrace();
}
}
--- 68,86 ----
//if no one else is creating the peer.
checkAndCreatePopupPeer();
updateImage();
}
private CPopupMenu checkAndCreatePopupPeer() {
CPopupMenu menuPeer = null;
if (popup != null) {
try {
! final MenuComponentAccessor acc = getMenuComponentAccessor();
! menuPeer = acc.getPeer(popup);
if (menuPeer == null) {
popup.addNotify();
! menuPeer = acc.getPeer(popup);
}
} catch (Exception e) {
e.printStackTrace();
}
}