This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 197639
Collapse All | Expand All

(-)a/openide.awt/src/org/openide/awt/Actions.java (-7 / +28 lines)
Lines 220-233 Link Here
220
220
221
    /** Connects buttons to action. If the action supplies value for "iconBase"
221
    /** Connects buttons to action. If the action supplies value for "iconBase"
222
     * key from getValue(String) with a path to icons the methods setIcon,
222
     * key from getValue(String) with a path to icons the methods setIcon,
223
     * setPressedIcon, setDisabledIcon and setRolloverIcon will be called on the
223
     * setPressedIcon, setDisabledIcon, setRolloverIcon
224
     * setSelectedIcon, setRolloverSelectedIcon and SetDisabledSelectedIcon
225
     * will be called on the
224
     * button with loaded icons using the iconBase. E.g. if the value for "iconBase"
226
     * button with loaded icons using the iconBase. E.g. if the value for "iconBase"
225
     * will be "com/mycompany/myIcon.gif" following images will be tried "com/mycompany/myIcon.gif"
227
     * will be "com/mycompany/myIcon.gif" following images will be tried
226
     * for setIcon, "com/mycompany/myIcon_pressed.gif" for setPressedIcon,
228
     * "com/mycompany/myIcon.gif" for setIcon,
227
     * "com/mycompany/myIcon_disabled.gif" for setDisabledIcon and
229
     * "com/mycompany/myIcon_pressed.gif" for setPressedIcon,
228
     * "com/mycompany/myIcon_rollover.gif" for setRolloverIcon. SystemAction has
230
     * "com/mycompany/myIcon_disabled.gif" for setDisabledIcon,
229
     * special support for iconBase - please check {@link SystemAction#iconResource}
231
     * "com/mycompany/myIcon_rollover.gif" for setRolloverIcon,
230
     * for more details.
232
     * "com/mycompany/myIcon_selected.gif" for setSelectedIcon,
233
     * "com/mycompany/myIcon_rolloverSelected.gif" for setRolloverSelectedIcon and
234
     * "com/mycompany/myIcon_disabledSelected.gif" for setDisabledSelectedIcon.
235
     * SystemAction has special support for iconBase - please check
236
     * {@link SystemAction#iconResource} for more details.
231
     * You can supply an alternative implementation
237
     * You can supply an alternative implementation
232
     * for this method by implementing method
238
     * for this method by implementing method
233
     * {@link ButtonActionConnector#connect(AbstractButton, Action)} and
239
     * {@link ButtonActionConnector#connect(AbstractButton, Action)} and
Lines 1025-1030 Link Here
1025
                } else if (imgIcon != null) {
1031
                } else if (imgIcon != null) {
1026
                    button.setDisabledIcon(ImageUtilities.createDisabledIcon(imgIcon));
1032
                    button.setDisabledIcon(ImageUtilities.createDisabledIcon(imgIcon));
1027
                }
1033
                }
1034
1035
                ImageIcon sImgIcon = ImageUtilities.loadImageIcon(insertBeforeSuffix(b, "_selected"), true); // NOI18N
1036
                if (sImgIcon != null) {
1037
                    button.setSelectedIcon(sImgIcon);
1038
                }
1039
1040
                sImgIcon = ImageUtilities.loadImageIcon(insertBeforeSuffix(b, "_rolloverSelected"), true); // NOI18N
1041
                if (sImgIcon != null) {
1042
                    button.setRolloverSelectedIcon(sImgIcon);
1043
                }
1044
1045
                sImgIcon = ImageUtilities.loadImageIcon(insertBeforeSuffix(b, "_disabledSelected"), true); // NOI18N
1046
                if (sImgIcon != null) {
1047
                    button.setDisabledSelectedIcon(sImgIcon);
1048
                }
1028
            }
1049
            }
1029
        }
1050
        }
1030
1051
(-)a/openide.awt/src/org/openide/awt/AlwaysEnabledAction.java (-1 / +20 lines)
Lines 19-24 Link Here
19
import javax.swing.AbstractAction;
19
import javax.swing.AbstractAction;
20
import javax.swing.Action;
20
import javax.swing.Action;
21
import javax.swing.Icon;
21
import javax.swing.Icon;
22
import javax.swing.JButton;
22
import javax.swing.JCheckBoxMenuItem;
23
import javax.swing.JCheckBoxMenuItem;
23
import javax.swing.JMenuItem;
24
import javax.swing.JMenuItem;
24
import org.openide.util.ContextAwareAction;
25
import org.openide.util.ContextAwareAction;
Lines 27-32 Link Here
27
import org.openide.util.LookupEvent;
28
import org.openide.util.LookupEvent;
28
import org.openide.util.LookupListener;
29
import org.openide.util.LookupListener;
29
import org.openide.util.NbPreferences;
30
import org.openide.util.NbPreferences;
31
import org.openide.util.WeakSet;
30
import org.openide.util.actions.Presenter;
32
import org.openide.util.actions.Presenter;
31
import org.openide.util.actions.ActionInvoker;
33
import org.openide.util.actions.ActionInvoker;
32
34
Lines 256-262 Link Here
256
    }
258
    }
257
259
258
    static final class CheckBox extends AlwaysEnabledAction
260
    static final class CheckBox extends AlwaysEnabledAction
259
            implements Presenter.Menu, Presenter.Popup, PreferenceChangeListener, LookupListener
261
            implements Presenter.Menu, Presenter.Popup, Presenter.Toolbar, PreferenceChangeListener, LookupListener
260
    {
262
    {
261
263
262
        private static final long serialVersionUID = 1L;
264
        private static final long serialVersionUID = 1L;
Lines 271-276 Link Here
271
273
272
        private JCheckBoxMenuItem popupItem;
274
        private JCheckBoxMenuItem popupItem;
273
275
276
        private WeakSet<JButton> toolbarItems;
277
274
        private Preferences preferencesNode;
278
        private Preferences preferencesNode;
275
279
276
        private Lookup.Result<Preferences> preferencesNodeResult;
280
        private Lookup.Result<Preferences> preferencesNodeResult;
Lines 311-316 Link Here
311
            return popupItem;
315
            return popupItem;
312
        }
316
        }
313
317
318
        public JButton getToolbarPresenter() {
319
            if(toolbarItems == null) {
320
                toolbarItems = new WeakSet<JButton>(4);
321
            }
322
            JButton b = new JButton();
323
            toolbarItems.add(b);
324
            Actions.connect(b, this);
325
            return b;
326
        }
327
314
        public void preferenceChange(PreferenceChangeEvent pce) {
328
        public void preferenceChange(PreferenceChangeEvent pce) {
315
            updateItemsSelected();
329
            updateItemsSelected();
316
        }
330
        }
Lines 351-356 Link Here
351
            if (popupItem != null) {
365
            if (popupItem != null) {
352
                popupItem.setSelected(selected);
366
                popupItem.setSelected(selected);
353
            }
367
            }
368
            if (toolbarItems != null) {
369
                for(JButton b : toolbarItems) {
370
                    b.setSelected(selected);
371
                }
372
            }
354
        }
373
        }
355
374
356
        private synchronized Preferences prefs() {
375
        private synchronized Preferences prefs() {

Return to bug 197639