Hi Roman,

On Fri, 2006-03-17 at 14:52 +0100, Roman Kennke wrote:
> 2006-03-17  Roman Kennke  <[EMAIL PROTECTED]>
> 
>         * javax/swing/JPopupMenu.java
>         (setVisible): Handle JPopupMenu opening and closing via
>         the MenuSelectionHandler.

You forgot to attached the actual patch. So now I am allowed to nitpick.
Here is the patch you committed:

Index: javax/swing/JPopupMenu.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JPopupMenu.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- javax/swing/JPopupMenu.java 13 Mar 2006 21:33:37 -0000      1.34
+++ javax/swing/JPopupMenu.java 17 Mar 2006 13:50:56 -0000      1.35
@@ -541,11 +541,25 @@
     this.visible = visible;
     if (old != isVisible())
       {
-        firePropertyChange("visible", old, isVisible());
         if (visible)
           {
+            if (invoker != null && !(invoker instanceof JMenu))
+              {
+                MenuElement[] menuEls;
+                if (getSubElements().length > 0)
+                  {
+                    menuEls = new MenuElement[2];
+                    menuEls[0] = this;
+                    menuEls[1] = getSubElements()[0];
+                }

This closing bracket should be at the same position as the opening
bracket. It is also slightly cheaper to call getSubElements() once and
work with the result in the condition and then branch.

+                else
+                  {
+                    menuEls = new MenuElement[1];
+                    menuEls[0] = this;
+                  }
+                MenuSelectionManager.defaultManager().setSelectedPath(menuEls);
+              }
             firePopupMenuWillBecomeVisible();
-
             PopupFactory pf = PopupFactory.getSharedInstance();
             pack();
             popup = pf.getPopup(invoker, this, popupLocationX, popupLocationY);
@@ -553,9 +567,11 @@
           }
         else
           {
+            getSelectionModel().clearSelection();
             firePopupMenuWillBecomeInvisible();
             popup.hide();
           }
+        firePropertyChange("visible", old, isVisible());
       }
   }
 
Cheers,

Mark

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to