[PATCH] 7186371: Main menu shortcuts not displayed (7u6 regression)

Marco Dinacci marco.dinacci at gmail.com
Tue Sep 4 07:01:53 PDT 2012


Hello,

the attached patch provides a workaround for bug
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7186371

I discussed about this problem a while ago but my suggested change was
causing bug #7160951.
I'm reposting now this patch since I also proposed a patch to fix #7160951.

The change consists simply in calling setAccelerator after calling
setLabel since setLabel(String) resets all informations about the
keyboard accelerator.

--- a/src/macosx/classes/com/apple/laf/ScreenMenuItem.java	Mon Jun 18
11:31:18 2012 +0100
+++ b/src/macosx/classes/com/apple/laf/ScreenMenuItem.java	Mon Jun 18
16:56:31 2012 +0100
@@ -56,24 +56,23 @@ class ScreenMenuItem extends MenuItem im

         fMenuItem.addComponentListener(this);
         fListener = new ScreenMenuPropertyListener(this);
         fMenuItem.addPropertyChangeListener(fListener);
         addActionListener(this);

         setEnabled(fMenuItem.isEnabled());

-        // can't setState or setAccelerator or setIcon till we have a peer
-        setAccelerator(fMenuItem.getAccelerator());
-
         final String label = fMenuItem.getText();
         if (label != null) {
             setLabel(label);
         }

+        setAccelerator(fMenuItem.getAccelerator());
+
         final Icon icon = fMenuItem.getIcon();
         if (icon != null) {
             this.setIcon(icon);
         }

         final String tooltipText = fMenuItem.getToolTipText();
         if (tooltipText != null) {
             this.setToolTipText(tooltipText);


Best,
Marco


More information about the macosx-port-dev mailing list