Changeset 8720 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2015-09-02T23:11:47+02:00 (9 years ago)
Author:
simon04
Message:

fix #11583 - Add mnemonic key to "Search menu items": ALT+R

R … think of Run command :)

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

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

    r8689 r8720  
    849849            }
    850850        };
     851        Shortcut searchFieldShortcut = Shortcut.registerShortcut("menu:search-field", tr("Search menu items"), KeyEvent.VK_R, Shortcut.MNEMONIC);
     852        searchFieldShortcut.setFocusAccelerator(searchField);
    851853        searchField.setEditable(true);
    852854        searchField.setMaximumSize(new Dimension(200, helpMenu.getPreferredSize().height));
    853855        searchField.setHint(tr("Search menu items"));
    854         searchField.setToolTipText(tr("Search menu items"));
     856        searchField.setToolTipText(Main.platform.makeTooltip(tr("Search menu items"), searchFieldShortcut));
    855857        searchField.addKeyListener(new SearchFieldKeyListener());
    856858        searchField.getDocument().addDocumentListener(new SearchFieldTextListener(this, searchField));
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r8510 r8720  
    1717import javax.swing.JMenu;
    1818import javax.swing.KeyStroke;
     19import javax.swing.text.JTextComponent;
    1920
    2021import org.openstreetmap.josm.Main;
     
    215216    }
    216217    /**
     218     * Sets the mnemonic key on a text component.
     219     */
     220    public void setFocusAccelerator(JTextComponent component) {
     221        if (assignedModifier == getGroupModifier(MNEMONIC)  && getKeyStroke() != null && KeyEvent.getKeyText(assignedKey).length() == 1) {
     222            component.setFocusAccelerator(KeyEvent.getKeyText(assignedKey).charAt(0));
     223        }
     224    }
     225    /**
    217226     * use this to set a actions's accelerator
    218227     */
Note: See TracChangeset for help on using the changeset viewer.