1 21 22 package swingwtx.swing; 23 24 25 public class KeyStroke { 26 27 private int keyCode = 0; 28 private int modifiers = 0; 29 30 31 private KeyStroke() { } 32 33 public static KeyStroke getKeyStroke(int keyCode, int modifiers) { 34 KeyStroke k = new KeyStroke(); 35 k.setKeyCode(keyCode); 36 k.setModifiers(modifiers); 37 return k; 38 } 39 40 41 public static KeyStroke getKeyStroke(String namedConstant) { 42 return new KeyStroke(); 46 } 47 48 public static KeyStroke getKeyStroke(int keyCode) { 49 return getKeyStroke(keyCode, 0); 50 } 51 52 56 public int getKeyCode() { 57 return keyCode; 58 } 59 60 64 public void setKeyCode(int keyCode) { 65 this.keyCode = keyCode; 66 } 67 68 72 public int getModifiers() { 73 return modifiers; 74 } 75 76 80 public void setModifiers(int modifiers) { 81 this.modifiers = modifiers; 82 } 83 84 } 85 | Popular Tags |