public synchronized void showPopupMenu(final int x, final int y) { if (isDisposed()) return; SunToolkit.executeOnEventHandlerThread(target, new Runnable() { public void run() { PopupMenu newPopup = ((TrayIcon)target).getPopupMenu(); if (popup != newPopup) { if (popup != null) { popupParent.remove(popup); } if (newPopup != null) { popupParent.add(newPopup); } popup = newPopup; } if (popup != null) { ((WPopupMenuPeer)popup.getPeer()).show(popupParent, new Point(x, y)); } } }); }