jdk/src/share/classes/javax/swing/MenuSelectionManager.java
changeset 459 d555ba8bbec1
parent 2 90ce3da70b43
child 715 f16baef3a20e
--- a/jdk/src/share/classes/javax/swing/MenuSelectionManager.java	Wed Apr 30 13:01:01 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/MenuSelectionManager.java	Wed Apr 30 13:19:26 2008 +0400
@@ -218,9 +218,9 @@
         int selectionSize;
         p = event.getPoint();
 
-        Component source = (Component)event.getSource();
+        Component source = event.getComponent();
 
-        if (!source.isShowing()) {
+        if ((source != null) && !source.isShowing()) {
             // This can happen if a mouseReleased removes the
             // containing component -- bug 4146684
             return;
@@ -236,7 +236,9 @@
             return;
         }
 
-        SwingUtilities.convertPointToScreen(p,source);
+        if (source != null) {
+            SwingUtilities.convertPointToScreen(p, source);
+        }
 
         screenX = p.x;
         screenY = p.y;