source: josm/trunk/src/org/openstreetmap/josm/tools/ShortCutLabel.java@ 674

Last change on this file since 674 was 627, checked in by framm, 16 years ago
  • Property svn:eol-style set to native
File size: 981 bytes
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.tools;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.KeyEvent;
7
8
9public class ShortCutLabel {
10 public static String name(int shortCut, int modifiers) {
11 if (shortCut == 0 && modifiers == 0)
12 return "";
13 String s = "";
14 if ((modifiers & KeyEvent.CTRL_MASK) != 0 || (modifiers & KeyEvent.CTRL_DOWN_MASK) != 0)
15 s += tr("Ctrl-");
16 if ((modifiers & KeyEvent.ALT_MASK) != 0 || (modifiers & KeyEvent.ALT_DOWN_MASK) != 0)
17 s += tr("Alt-");
18 if ((modifiers & KeyEvent.ALT_GRAPH_MASK) != 0 || (modifiers & KeyEvent.ALT_GRAPH_DOWN_MASK) != 0)
19 s += tr("AltGr-");
20 if ((modifiers & KeyEvent.SHIFT_MASK) != 0 || (modifiers & KeyEvent.SHIFT_DOWN_MASK) != 0)
21 s += tr("Shift-");
22 if (shortCut >= KeyEvent.VK_F1 && shortCut <= KeyEvent.VK_F12)
23 s += "F"+(shortCut-KeyEvent.VK_F1+1);
24 else
25 s += Character.toUpperCase((char)shortCut);
26 return s;
27 }
28}
Note: See TracBrowser for help on using the repository browser.