summaryrefslogtreecommitdiff
path: root/javax/swing/JMenuItem.java
diff options
context:
space:
mode:
Diffstat (limited to 'javax/swing/JMenuItem.java')
-rw-r--r--javax/swing/JMenuItem.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/javax/swing/JMenuItem.java b/javax/swing/JMenuItem.java
index c87a4dc2b..c3c10d6ef 100644
--- a/javax/swing/JMenuItem.java
+++ b/javax/swing/JMenuItem.java
@@ -117,6 +117,13 @@ public class JMenuItem extends AbstractButton implements Accessible,
super();
super.setAction(action);
init(null, null);
+ if (action != null)
+ {
+ setName((String) action.getValue(Action.NAME));
+ setAccelerator((KeyStroke) action.getValue(Action.ACCELERATOR_KEY));
+ setMnemonic(((Integer) action.getValue(Action.MNEMONIC_KEY)).intValue());
+ setActionCommand((String) action.getValue(Action.ACTION_COMMAND_KEY));
+ }
}
/**
@@ -273,8 +280,9 @@ public class JMenuItem extends AbstractButton implements Accessible,
if (! (this instanceof JMenu) && action != null)
{
setAccelerator((KeyStroke) (action.getValue(Action.ACCELERATOR_KEY)));
- super.registerKeyboardAction(action, accelerator,
- JComponent.WHEN_IN_FOCUSED_WINDOW);
+ if (accelerator != null)
+ super.registerKeyboardAction(action, accelerator,
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
}
}