Changeset 13840 in josm


Ignore:
Timestamp:
2018-05-26T13:45:02+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16319 - scale properly icon of Help button

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java

    r12678 r13840  
    1616
    1717import javax.swing.AbstractAction;
    18 import javax.swing.Action;
    1918import javax.swing.Icon;
    2019import javax.swing.JButton;
     
    2423import javax.swing.event.ChangeListener;
    2524
     25import org.openstreetmap.josm.actions.JosmAction;
    2626import org.openstreetmap.josm.gui.help.HelpBrowser;
    2727import org.openstreetmap.josm.gui.help.HelpUtil;
     
    180180     * @return the help button
    181181     */
    182     private static JButton createHelpButton(final String helpTopic) {
    183         JButton b = new JButton(tr("Help"));
    184         b.setIcon(ImageProvider.get("help"));
    185         b.setToolTipText(tr("Show help information"));
     182    private static JButton createHelpButton(String helpTopic) {
     183        JButton b = new JButton(new HelpAction(helpTopic));
    186184        HelpUtil.setHelpContext(b, helpTopic);
    187         Action a = new AbstractAction() {
    188             @Override
    189             public void actionPerformed(ActionEvent e) {
    190                 HelpBrowser.setUrlForHelpTopic(helpTopic);
    191             }
    192         };
    193         b.addActionListener(a);
    194185        InputMapUtils.enableEnter(b);
    195186        return b;
     187    }
     188
     189    private static class HelpAction extends JosmAction {
     190        private final String helpTopic;
     191
     192        HelpAction(String helpTopic) {
     193            super(tr("Help"), "help", tr("Show help information"), null, false, false);
     194            this.helpTopic = helpTopic;
     195        }
     196
     197        @Override
     198        public void actionPerformed(ActionEvent e) {
     199            HelpBrowser.setUrlForHelpTopic(helpTopic);
     200        }
    196201    }
    197202
Note: See TracChangeset for help on using the changeset viewer.