/** Constructor. */ public SubMenuBridge(JMenuItem one, JMenu more, Action action, SubMenuModel model, boolean popup) { super(one, action, popup); single = one; multi = more; setMenuText(multi, (String)action.getValue(Action.NAME), popup); prepareMargins(one, action); prepareMargins(more, action); currentOnes = new ArrayList<JMenuItem>(); this.model = model; }
/** @param changedProperty the name of property that has changed * or null if it is not known */ @Override public void updateState(String changedProperty) { super.updateState(changedProperty); if ((changedProperty == null) || !changedProperty.equals(Action.ACCELERATOR_KEY)) { updateKey((JMenuItem) comp, action); } if ((changedProperty == null) || changedProperty.equals(Action.NAME)) { Object s = action.getValue(Action.NAME); if (s instanceof String) { setMenuText(((JMenuItem) comp), (String) s, true); } } }
setMenuText(((JMenuItem) comp), (String) s, useMnemonic);
public MenuWithRecent(Node n, boolean writable) { super(); //NewTemplateAction.this.getName()); Actions.setMenuText(this, NewTemplateAction.this.getName(), false); node = n; canWrite = writable; }
/** @param changedProperty the name of property that has changed * or null if it is not known */ public void updateState (String changedProperty) { super.updateState (changedProperty); if (changedProperty == null || !changedProperty.equals (Action.ACCELERATOR_KEY)) { updateKey ((JMenuItem)comp, action); } if (changedProperty == null || changedProperty.equals (Action.NAME)) { Object s = action.getValue (Action.NAME); if (s instanceof String) { setMenuText (((JMenuItem)comp), (String)s, !popup); } } }
/** @param changedProperty the name of property that has changed * or null if it is not known */ public void updateState (String changedProperty) { super.updateState (changedProperty); if (changedProperty == null || !changedProperty.equals (Action.ACCELERATOR_KEY)) { updateKey ((JMenuItem)comp, action); } if (changedProperty == null || changedProperty.equals (Action.NAME)) { Object s = action.getValue (Action.NAME); if (s instanceof String) { setMenuText (((JMenuItem)comp), (String)s, !popup); } } }
/** @param changedProperty the name of property that has changed * or null if it is not known */ public void updateState (String changedProperty) { if (changedProperty == null || changedProperty.equals (SystemAction.PROP_ENABLED)) { button.setEnabled (action.isEnabled ()); } if (changedProperty == null || !changedProperty.equals (Action.ACCELERATOR_KEY)) { updateKey ((JMenuItem)comp, action); } if (!popup) { if (changedProperty == null || changedProperty.equals (SystemAction.PROP_ICON) || changedProperty.equals(Action.SMALL_ICON) || changedProperty.equals("iconBase")) { // NOI18N updateButtonIcon(); } } if (changedProperty == null || changedProperty.equals (Action.NAME)) { Object s = action.getValue (Action.NAME); if (s instanceof String) { setMenuText (((JMenuItem)comp), (String)s, !popup); } } }
/** @param changedProperty the name of property that has changed * or null if it is not known */ public void updateState (String changedProperty) { if (changedProperty == null || changedProperty.equals (SystemAction.PROP_ENABLED)) { button.setEnabled (action.isEnabled ()); } if (changedProperty == null || !changedProperty.equals (Action.ACCELERATOR_KEY)) { updateKey ((JMenuItem)comp, action); } if (!popup) { if (changedProperty == null || changedProperty.equals (SystemAction.PROP_ICON) || changedProperty.equals(Action.SMALL_ICON) || changedProperty.equals("iconBase")) { // NOI18N updateButtonIcon(); } } if (changedProperty == null || changedProperty.equals (Action.NAME)) { Object s = action.getValue (Action.NAME); if (s instanceof String) { setMenuText (((JMenuItem)comp), (String)s, !popup); } } }
private void updateProps() { // set the text and be aware of mnemonics Node n = master.getNodeDelegate (); Actions.setMenuText(this, n.getDisplayName (), true); if (icon) setIcon (new ImageIcon ( n.getIcon (java.beans.BeanInfo.ICON_COLOR_16x16))); }
/** Initializes listeners atc to the given workspace */ void attachWorkspace (Workspace workspace, Workspace[] currentDeskRef, Hashtable workspace2Menu, Hashtable menu2Workspace, Hashtable workspace2Listener, JMenu menu) { // bugfix #6116 - change from getName() to getDisplayName() JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(); Actions.setMenuText(menuItem, workspace.getDisplayName(), true); HelpCtx.setHelpIDString (menuItem, WorkspaceSwitchAction.class.getName()); ActionListener listener = createActionListener(menuItem, currentDeskRef, menu2Workspace, workspace2Menu); menuItem.addActionListener(listener); menu2Workspace.put(listener, workspace); workspace2Listener.put(workspace, listener); workspace2Menu.put(workspace, menuItem); workspace.addPropertyChangeListener(createNameListener(menuItem)); menu.add(menuItem); }
/** Initializes listeners atc to the given workspace */ void attachWorkspace (Workspace workspace, Workspace[] currentDeskRef, Hashtable workspace2Menu, Hashtable menu2Workspace, Hashtable workspace2Listener, JMenu menu) { // bugfix #6116 - change from getName() to getDisplayName() JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(); Actions.setMenuText(menuItem, workspace.getDisplayName(), true); HelpCtx.setHelpIDString (menuItem, WorkspaceSwitchAction.class.getName()); ActionListener listener = createActionListener(menuItem, currentDeskRef, menu2Workspace, workspace2Menu); menuItem.addActionListener(listener); menu2Workspace.put(listener, workspace); workspace2Listener.put(workspace, listener); workspace2Menu.put(workspace, menuItem); workspace.addPropertyChangeListener(createNameListener(menuItem)); menu.add(menuItem); }
Actions.setMenuText(menu, getName(), true); menu.setHorizontalTextPosition(JMenu.RIGHT); menu.setHorizontalAlignment(JMenu.LEFT);
Actions.setMenuText(menu, getName(), true); menu.setHorizontalTextPosition(JMenu.RIGHT); menu.setHorizontalAlignment(JMenu.LEFT);