/** * Enables and disables this button and if an action is assigned to this * menuitem the propertychange is forwarded to the assigned action. * * @param b the new enable-state of this menuitem */ public void setEnabled(final boolean b) { super.setEnabled(b); if (getAction() != null) { getAction().setEnabled(b); } }
/** * Creates a new menu item based on the specified action. * * @param action the action. */ public ActionMenuItem(final Action action) { setAction(action); }
final Action oldAction = getAction(); if (oldAction != null) removeActionListener(oldAction); oldAction.removePropertyChangeListener(getPropertyChangeHandler()); setAccelerator(null); addActionListener(newAction); newAction.addPropertyChangeListener(getPropertyChangeHandler()); setText((String) (newAction.getValue(Action.NAME))); setToolTipText((String) (newAction.getValue(Action.SHORT_DESCRIPTION))); setIcon((Icon) newAction.getValue(Action.SMALL_ICON)); setEnabled(this.action.isEnabled()); setMnemonic(c.charValue()); setMnemonic(c.intValue()); setMnemonic(KeyEvent.VK_UNDEFINED); if (o instanceof KeyStroke) setAccelerator((KeyStroke) o);
setEnabled(getAction().isEnabled()); setIcon((Icon) getAction().getValue(Action.SMALL_ICON)); setText((String) getAction().getValue(Action.NAME)); ActionMenuItem.this.setToolTipText((String) getAction().getValue(Action.SHORT_DESCRIPTION)); final Action ac = getAction(); if (event.getPropertyName().equals(ActionDowngrade.ACCELERATOR_KEY)) setAccelerator((KeyStroke) ac.getValue(ActionDowngrade.ACCELERATOR_KEY)); setMnemonic(c.charValue()); setMnemonic(c.intValue()); setMnemonic(KeyEvent.VK_UNDEFINED);
final Action oldAction = getAction(); if (oldAction != null) removeActionListener(oldAction); oldAction.removePropertyChangeListener(getPropertyChangeHandler()); setAccelerator(null); addActionListener(newAction); newAction.addPropertyChangeListener(getPropertyChangeHandler()); setText((String) (newAction.getValue(Action.NAME))); setToolTipText((String) (newAction.getValue(Action.SHORT_DESCRIPTION))); setIcon((Icon) newAction.getValue(Action.SMALL_ICON)); setEnabled(this.action.isEnabled()); setMnemonic(c.charValue()); setMnemonic(c.intValue()); setMnemonic(KeyEvent.VK_UNDEFINED); if (o instanceof KeyStroke) setAccelerator((KeyStroke) o);
setEnabled(getAction().isEnabled()); setIcon((Icon) getAction().getValue(Action.SMALL_ICON)); setText((String) getAction().getValue(Action.NAME)); ActionMenuItem.this.setToolTipText((String) getAction().getValue(Action.SHORT_DESCRIPTION)); final Action ac = getAction(); if (event.getPropertyName().equals(ActionDowngrade.ACCELERATOR_KEY)) setAccelerator((KeyStroke) ac.getValue(ActionDowngrade.ACCELERATOR_KEY)); setMnemonic(c.charValue()); setMnemonic(c.intValue()); setMnemonic(KeyEvent.VK_UNDEFINED);
final Action oldAction = getAction(); if (oldAction != null) removeActionListener(oldAction); oldAction.removePropertyChangeListener(getPropertyChangeHandler()); setAccelerator(null); addActionListener(newAction); newAction.addPropertyChangeListener(getPropertyChangeHandler()); setText((String) (newAction.getValue(Action.NAME))); setToolTipText((String) (newAction.getValue(Action.SHORT_DESCRIPTION))); setIcon((Icon) newAction.getValue(Action.SMALL_ICON)); setEnabled(this.action.isEnabled()); setMnemonic(c.charValue()); setMnemonic(c.intValue()); setMnemonic(KeyEvent.VK_UNDEFINED); if (o instanceof KeyStroke) setAccelerator((KeyStroke) o);
setEnabled(getAction().isEnabled()); setIcon((Icon) getAction().getValue(Action.SMALL_ICON)); setText((String) getAction().getValue(Action.NAME)); ActionMenuItem.this.setToolTipText((String) getAction().getValue(Action.SHORT_DESCRIPTION)); final Action ac = getAction(); if (event.getPropertyName().equals(ActionDowngrade.ACCELERATOR_KEY)) setAccelerator((KeyStroke) ac.getValue(ActionDowngrade.ACCELERATOR_KEY)); setMnemonic(c.charValue()); setMnemonic(c.intValue()); setMnemonic(KeyEvent.VK_UNDEFINED);
/** * Creates a new menu item based on the specified action. * * @param action the action. */ public ActionMenuItem(final Action action) { setAction(action); }
/** * Enables and disables this button and if an action is assigned to this * menuitem the propertychange is forwarded to the assigned action. * * @param b the new enable-state of this menuitem */ public void setEnabled(final boolean b) { super.setEnabled(b); if (getAction() != null) { getAction().setEnabled(b); } }
/** * Creates a new menu item based on the specified action. * * @param action the action. */ public ActionMenuItem(final Action action) { setAction(action); }
/** * Enables and disables this button and if an action is assigned to this * menuitem the propertychange is forwarded to the assigned action. * * @param b the new enable-state of this menuitem */ public void setEnabled(final boolean b) { super.setEnabled(b); if (getAction() != null) { getAction().setEnabled(b); } }