List of utility methods to do Swing Key Action
KeyStroke[] | stringToKeys(String s) Convert a space-separated list of Emacs-like key binding names to a list of Swing key strokes. StringTokenizer st = new StringTokenizer(s.toUpperCase(Locale.ENGLISH), " "); ArrayList<KeyStroke> arr = new ArrayList<KeyStroke>(); while (st.hasMoreElements()) { s = st.nextToken(); KeyStroke k = stringToKey(s); if (k == null) { return null; arr.add(k); return arr.toArray(new KeyStroke[arr.size()]); |
String | translate(KeyStroke keyStroke, Locale locale) Returns the key stroke representation translated. String acceleratorText = ""; if (keyStroke != null) { int modifiers = keyStroke.getModifiers(); if (modifiers > 0) { acceleratorText = KeyEvent.getKeyModifiersText(modifiers); acceleratorText += "+"; acceleratorText += KeyEvent.getKeyText(keyStroke.getKeyCode()); ... |
void | validarNumeroInteiro(KeyEvent evt) validar Numero Inteiro if (!Character.isDigit(evt.getKeyChar()) && evt.getKeyChar() != '-') evt.consume(); if (((JTextField) evt.getSource()).getText().length() > 0 && evt.getKeyChar() == '-') evt.consume(); |