Bridge b = new MenuBridge(item, action, popup); b.prepare();
i = sa.getIcon(useTextIcons()); if( i != null ) { button.setIcon((Icon) i); ImageIcon pImgIcon = ImageUtilities.loadImageIcon(insertBeforeSuffix(b, "_pressed"), true); // NOI18N if (pImgIcon != null) { button.setPressedIcon(pImgIcon); ImageIcon rImgIcon = ImageUtilities.loadImageIcon(insertBeforeSuffix(b, "_rollover"), true); // NOI18N if (rImgIcon != null) { button.setRolloverIcon(rImgIcon); ImageIcon dImgIcon = ImageUtilities.loadImageIcon(insertBeforeSuffix(b, "_disabled"), true); // NOI18N if (dImgIcon != null) { button.setDisabledIcon(dImgIcon);
changedProperty.equals(Action.SMALL_ICON) || changedProperty.equals("iconBase") updateButtonIcon();
i = sa.getIcon (useTextIcons ()); button.setIcon((Icon)i); if (i instanceof ImageIcon) { Image pImg = Utilities.loadImage(insertBeforeSuffix(b, "_pressed"), true); // NOI18N if (pImg != null) { button.setPressedIcon(new ImageIcon(pImg)); Image rImg = Utilities.loadImage(insertBeforeSuffix(b, "_rollover"), true); // NOI18N if (rImg != null) { button.setRolloverIcon(new ImageIcon(rImg)); Image dImg = Utilities.loadImage(insertBeforeSuffix(b, "_disabled"), true); // NOI18N if (dImg != null) { button.setDisabledIcon(new ImageIcon(dImg));
i = sa.getIcon (useTextIcons ()); button.setIcon((Icon)i); if (i instanceof ImageIcon) { Image pImg = Utilities.loadImage(insertBeforeSuffix(b, "_pressed"), true); // NOI18N if (pImg != null) { button.setPressedIcon(new ImageIcon(pImg)); Image rImg = Utilities.loadImage(insertBeforeSuffix(b, "_rollover"), true); // NOI18N if (rImg != null) { button.setRolloverIcon(new ImageIcon(rImg)); Image dImg = Utilities.loadImage(insertBeforeSuffix(b, "_disabled"), true); // NOI18N if (dImg != null) { button.setDisabledIcon(new ImageIcon(dImg));
/** @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); } } }
/** Attaches menu item to an action. * @param item menu item * @param action action * @param popup create popup or menu item * @since 3.29 */ public static void connect (JMenuItem item, Action action, boolean popup) { Bridge b = new MenuBridge (item, action, popup); // Would make more sense to defer this until addNotify, but for some reason (why?) // if you do that, various menus start out compacted and poorly painted. b.updateState (null); if (!popup) { // #39508 fix. setMenuActionConnection(item, action); } }
/** Attaches menu item to an action. * @param item menu item * @param action action * @param popup create popup or menu item * @since 3.29 */ public static void connect (JMenuItem item, Action action, boolean popup) { Bridge b = new MenuBridge (item, action, popup); // Would make more sense to defer this until addNotify, but for some reason (why?) // if you do that, various menus start out compacted and poorly painted. b.updateState (null); if (!popup) { // #39508 fix. setMenuActionConnection(item, action); } }
public void removeNotify () { model.removeChangeListener (this); super.removeNotify (); }
public void removeNotify () { model.removeChangeListener (this); super.removeNotify (); }
static void prepareMenuBridgeItemsInContainer(Container c) { Component[] comps = c.getComponents(); for (int i=0; i<comps.length; i++) { if (comps[i] instanceof JComponent) { JComponent cop = (JComponent)comps[i]; MenuBridge bridge = (MenuBridge)cop.getClientProperty("menubridgeresizehack"); if (bridge != null) { bridge.updateState(null); } } } }
public void addNotify () { super.addNotify (); model.addChangeListener (this); generateSubMenu (); }
static void prepareMenuBridgeItemsInContainer(Container c) { Component[] comps = c.getComponents(); for (int i=0; i<comps.length; i++) { if (comps[i] instanceof JComponent) { JComponent cop = (JComponent)comps[i]; MenuBridge bridge = (MenuBridge)cop.getClientProperty("menubridgeresizehack"); if (bridge != null) { bridge.updateState(null); } } } }
public void addNotify () { super.addNotify (); model.addChangeListener (this); generateSubMenu (); }
@Override public void updateState(String changedProperty) { super.updateState(changedProperty); // checkVisibility(); }
static void prepareMenuBridgeItemsInContainer(Container c) { Component[] comps = c.getComponents(); for (int i = 0; i < comps.length; i++) { if (comps[i] instanceof JComponent) { JComponent cop = (JComponent) comps[i]; MenuBridge bridge = (MenuBridge) cop.getClientProperty("menubridgeresizehack"); if (bridge != null) { bridge.updateState(null); } } } }
protected @Override void prepare() { if (popup) { // popups generally get no hierarchy events, yet we need to listen to other changes addNotify(); } else { super.prepare(); } }