[jsword-svn] r1280 - trunk/common-swing/src/main/java/org/crosswire/common/swing

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Fri Apr 20 03:55:14 MST 2007


Author: dmsmith
Date: 2007-04-20 03:55:14 -0700 (Fri, 20 Apr 2007)
New Revision: 1280

Modified:
   trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java
Log:
Happiness for Mac: no mnemonics for actions.

Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java	2007-04-20 10:38:39 UTC (rev 1279)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/ActionFactory.java	2007-04-20 10:55:14 UTC (rev 1280)
@@ -41,6 +41,7 @@
 
 import org.crosswire.common.util.CWClassLoader;
 import org.crosswire.common.util.Logger;
+import org.crosswire.common.util.OSType;
 import org.crosswire.common.util.StringUtil;
 
 /**
@@ -165,8 +166,9 @@
         if (action != null)
         {
             label.setText(action.getValue(Action.NAME).toString());
+            // Mac's don't have mnemonics
             Integer mnemonic = (Integer) action.getValue(Action.MNEMONIC_KEY);
-            if (mnemonic != null)
+            if (mnemonic != null && !OSType.MAC.equals(OSType.getOSType()))
             {
                 label.setDisplayedMnemonic(mnemonic.intValue());
             }
@@ -359,6 +361,7 @@
             if ("ctrl".equalsIgnoreCase(modifier)) //$NON-NLS-1$
             {
                 // use this so MacOS users are happy
+                // It will map to the CMD key on Mac; CTRL otherwise.
                 keyModifier |= Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
             }
             else if ("shift".equalsIgnoreCase(modifier)) //$NON-NLS-1$
@@ -416,7 +419,11 @@
         cwAction.putValue(Action.SMALL_ICON, small_icon);
         cwAction.putValue(Action.SHORT_DESCRIPTION, short_desc);
         cwAction.putValue(Action.LONG_DESCRIPTION, long_desc);
-        cwAction.putValue(Action.MNEMONIC_KEY, mnemonic);
+        // Mac's don't have mnemonics
+        if (OSType.MAC.equals(OSType.getOSType()))
+        {
+            cwAction.putValue(Action.MNEMONIC_KEY, mnemonic);
+        }
         cwAction.putValue(Action.ACCELERATOR_KEY, accel);
         cwAction.setEnabled(enabled);
 




More information about the jsword-svn mailing list