- Timestamp:
- 2008-12-03T18:41:48+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/SideButton.java
r999 r1102 8 8 9 9 import org.openstreetmap.josm.tools.ImageProvider; 10 import org.openstreetmap.josm.tools.Shortcut; 10 11 11 12 public class SideButton extends JButton { … … 24 25 setToolTipText(tooltip); 25 26 } 27 @Deprecated 26 28 public SideButton(String name, String imagename, String property, String tooltip, int mnemonic, ActionListener actionListener) 27 29 { 28 30 super(tr(name), ImageProvider.get("dialogs", imagename)); 29 31 setMnemonic(mnemonic); 32 setup(name, property, tooltip, actionListener); 33 } 34 public SideButton(String name, String imagename, String property, String tooltip, Shortcut shortcut, ActionListener actionListener) 35 { 36 super(tr(name), ImageProvider.get("dialogs", imagename)); 37 if(shortcut != null) 38 shortcut.setMnemonic(this); 30 39 setup(name, property, tooltip, actionListener); 31 40 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r1084 r1102 429 429 public PropertiesDialog(MapFrame mapFrame) { 430 430 super(tr("Properties/Memberships"), "propertiesdialog", tr("Properties for selected objects."), 431 Shortcut.registerShortcut("subwindow:proper ies", tr("Toggle: {0}", tr("Properties/Memberships")), KeyEvent.VK_P,431 Shortcut.registerShortcut("subwindow:properties", tr("Toggle: {0}", tr("Properties/Memberships")), KeyEvent.VK_P, 432 432 Shortcut.GROUP_LAYER, Shortcut.SHIFT_DEFAULT), 150); 433 433 … … 602 602 }; 603 603 604 buttonPanel.add(new SideButton(marktr("Add"),"add","Properties",tr("Add a new key/value pair to all objects"), KeyEvent.VK_A, buttonAction)); 605 buttonPanel.add(new SideButton(marktr("Edit"),"edit","Properties",tr("Edit the value of the selected key for all objects"), KeyEvent.VK_E, buttonAction)); 606 buttonPanel.add(new SideButton(marktr("Delete"),"delete","Properties",tr("Delete the selected key in all objects"), KeyEvent.VK_D, buttonAction)); 604 Shortcut s = Shortcut.registerShortcut("properties:add", tr("Add Properties"), KeyEvent.VK_B, 605 Shortcut.GROUP_MNEMONIC); 606 buttonPanel.add(new SideButton(marktr("Add"),"add","Properties", 607 tr("Add a new key/value pair to all objects"), s, buttonAction)); 608 609 s = Shortcut.registerShortcut("properties:edit", tr("Edit Properties"), KeyEvent.VK_I, 610 Shortcut.GROUP_MNEMONIC); 611 buttonPanel.add(new SideButton(marktr("Edit"),"edit","Properties", 612 tr("Edit the value of the selected key for all objects"), s, buttonAction)); 613 614 s = Shortcut.registerShortcut("properties:delete", tr("Delete Properties"), KeyEvent.VK_Q, 615 Shortcut.GROUP_MNEMONIC); 616 buttonPanel.add(new SideButton(marktr("Delete"),"delete","Properties", 617 tr("Delete the selected key in all objects"), s, buttonAction)); 607 618 add(buttonPanel, BorderLayout.SOUTH); 608 619 -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r1084 r1102 10 10 import java.util.Map; 11 11 import java.util.Collection; 12 import javax.swing.AbstractButton; 12 13 import javax.swing.KeyStroke; 13 14 import javax.swing.JMenu; … … 178 179 } 179 180 } 181 /** 182 * use this to set a buttons's mnemonic 183 */ 184 public void setMnemonic(AbstractButton button) { 185 if (requestedGroup == GROUP_MNEMONIC && assignedModifier == groups.get(requestedGroup + GROUPS_DEFAULT) && getKeyStroke() != null && KeyEvent.getKeyText(assignedKey).length() == 1) { 186 button.setMnemonic(KeyEvent.getKeyText(assignedKey).charAt(0)); //getKeyStroke().getKeyChar() seems not to work here 187 } 188 } 180 189 181 190 /**
Note:
See TracChangeset
for help on using the changeset viewer.