Changeset 6338 in josm


Ignore:
Timestamp:
2013-10-28T17:00:06+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #9220 - fix toggle actions for good

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ToggleAction.java

    r6327 r6338  
    1414import javax.swing.JToggleButton;
    1515
     16import org.openstreetmap.josm.Main;
    1617import org.openstreetmap.josm.tools.Shortcut;
    1718
     
    4142    public ToggleAction(String name, Icon icon, String tooltip, Shortcut shortcut, boolean registerInToolbar, String toolbarId, boolean installAdapters) {
    4243        super(name, icon, tooltip, shortcut, registerInToolbar, toolbarId, installAdapters);
     44        // It is required to set the SELECTED_KEY to a non-null value in order to let Swing components update it
     45        setSelected(false);
    4346    }
    4447
     
    5861    public ToggleAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar) {
    5962        super(name, iconName, tooltip, shortcut, registerInToolbar);
     63        // It is required to set the SELECTED_KEY to a non-null value in order to let Swing components update it
     64        setSelected(false);
    6065    }
    6166
     
    7378            return (Boolean) selected;
    7479        } else {
     80            Main.warn(getClass().getName()+" does not define a boolean for SELECTED_KEY but "+selected+". You should report it to JOSM developers.");
    7581            return false;
    7682        }
Note: See TracChangeset for help on using the changeset viewer.