changedProperty.equals(Action.SMALL_ICON) || changedProperty.equals("iconBase") updateButtonIcon();
/** @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(BooleanStateAction.PROP_BOOLEAN_STATE)) { button.setSelected(((BooleanStateAction) action).getBooleanState()); } } }
Image img = null; if (!useSmallIcon) { img = Utilities.loadImage(insertBeforeSuffix(b, "24"), true); // NOI18N if (img == null) { img = Utilities.loadImage(b, true); } else { SystemAction sa = (SystemAction)action; i = sa.getIcon (useTextIcons ()); button.setIcon((Icon)i); if (i instanceof ImageIcon) { i = sa.getIcon (useTextIcons ()); button.setIcon((Icon)i); if (i instanceof ImageIcon) { Image img = null; if (!useSmallIcon) { img = Utilities.loadImage(insertBeforeSuffix(b, "24"), true); // NOI18N if (img == null) { img = Utilities.loadImage(b, true); String b = (String) base; if (!useSmallIcon) { b = insertBeforeSuffix(b,"24"); //NOI18N Image pImg = Utilities.loadImage(insertBeforeSuffix(b, "_pressed"), true); // NOI18N if (pImg != null) { button.setPressedIcon(new ImageIcon(pImg));
Image img = null; if (!useSmallIcon) { img = Utilities.loadImage(insertBeforeSuffix(b, "24"), true); // NOI18N if (img == null) { img = Utilities.loadImage(b, true); } else { SystemAction sa = (SystemAction)action; i = sa.getIcon (useTextIcons ()); button.setIcon((Icon)i); if (i instanceof ImageIcon) { i = sa.getIcon (useTextIcons ()); button.setIcon((Icon)i); if (i instanceof ImageIcon) { Image img = null; if (!useSmallIcon) { img = Utilities.loadImage(insertBeforeSuffix(b, "24"), true); // NOI18N if (img == null) { img = Utilities.loadImage(b, true); String b = (String) base; if (!useSmallIcon) { b = insertBeforeSuffix(b,"24"); //NOI18N Image pImg = Utilities.loadImage(insertBeforeSuffix(b, "_pressed"), true); // NOI18N if (pImg != null) { button.setPressedIcon(new ImageIcon(pImg));
/** Connects buttons to action. If the action supplies value for "iconBase" * key from getValue(String) with a path to icons the methods setIcon, * setPressedIcon, setDisabledIcon and setRolloverIcon will be called on the * button with loaded icons using the iconBase. E.g. if the value for "iconBase" * will be "com/mycompany/myIcon.gif" following images will be tried "com/mycompany/myIcon.gif" * for setIcon, "com/mycompany/myIcon_pressed.gif" for setPressedIcon, * "com/mycompany/myIcon_disabled.gif" for setDisabledIcon and * "com/mycompany/myIcon_rollover.gif" for setRolloverIcon. SystemAction has * special support for iconBase - please check {@link SystemAction#iconResource} * for more details. * @param button the button * @param action the action * @since 3.29 */ public static void connect (AbstractButton button, Action action) { Bridge b = new ButtonBridge (button, action); b.updateState (null); }
/** Connects buttons to action. If the action supplies value for "iconBase" * key from getValue(String) with a path to icons the methods setIcon, * setPressedIcon, setDisabledIcon and setRolloverIcon will be called on the * button with loaded icons using the iconBase. E.g. if the value for "iconBase" * will be "com/mycompany/myIcon.gif" following images will be tried "com/mycompany/myIcon.gif" * for setIcon, "com/mycompany/myIcon_pressed.gif" for setPressedIcon, * "com/mycompany/myIcon_disabled.gif" for setDisabledIcon and * "com/mycompany/myIcon_rollover.gif" for setRolloverIcon. SystemAction has * special support for iconBase - please check {@link SystemAction#iconResource} * for more details. * @param button the button * @param action the action * @since 3.29 */ public static void connect (AbstractButton button, Action action) { Bridge b = new ButtonBridge (button, action); b.updateState (null); }
/** @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 (BooleanStateAction.PROP_BOOLEAN_STATE)) { button.setSelected (((BooleanStateAction)action).getBooleanState ()); } }
/** @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 (BooleanStateAction.PROP_BOOLEAN_STATE)) { button.setSelected (((BooleanStateAction)action).getBooleanState ()); } }
if (base instanceof String) { String b = (String) base; ImageIcon imgIcon = loadImage(b, useSmallIcon, null); if (imgIcon != null) { i = imgIcon; } else { SystemAction sa = (SystemAction) action; i = sa.getIcon(useTextIcons()); button.setIcon((Icon) i); button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon) i)); i = sa.getIcon(useTextIcons()); button.setIcon((Icon) i); button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon) i)); ImageIcon imgIcon = loadImage(b, useSmallIcon, null); // NOI18N if (imgIcon != null) { i = imgIcon; imgIcon = loadImage(b, useSmallIcon, null); if (imgIcon != null) { button.setIcon(imgIcon); ImageIcon pImgIcon = loadImage(b, useSmallIcon, "_pressed"); // NOI18N if (pImgIcon != null) { button.setPressedIcon(pImgIcon); ImageIcon rImgIcon = loadImage(b, useSmallIcon, "_rollover"); // NOI18N
Bridge b = new ButtonBridge(button, action); b.prepare();
protected @Override void prepare() { if (popup) { // popups generally get no hierarchy events, yet we need to listen to other changes addNotify(); } else { super.prepare(); } }
static ImageIcon loadImage(String iconBase, boolean useSmallIcon, String suffix) { if (!useSmallIcon) { String bigBase = insertBeforeSuffix(iconBase, "24"); // NOI18N ImageIcon icon = ImageUtilities.loadImageIcon(insertBeforeSuffix(bigBase, suffix), true); if (icon != null) { return icon; } } return ImageUtilities.loadImageIcon(insertBeforeSuffix(iconBase, suffix), true); // NOI18N }