public void enterCancelButton(Event ev) { if (ev.key == TAB) { if (ev.shiftDown()) OKButton.requestFocus(); else nameField.requestFocus(); } if (ev.key == NEWLINE) { handleEvent(new Event(this, Event.WINDOW_DESTROY, null)); } } // enterCancelButton
public void keyPressPasswordField(Event ev) { String tmp = ""; char ch = (char) ev.key; if ((EXCLAMATION <= ev.key) && (ev.key <= TILDE)) { password += ch; passwordField.setText(passwordField.getText() + "*"); } if (ev.key == BACKSPACE) { if (password.length() > 0) { tmp += password.substring(0, password.length() - 1); password = tmp; tmp = ""; for (int index = 0; index < password.length(); index++) tmp += "*"; passwordField.setText(tmp); tmp = ""; } } if ((ev.key == TAB) || (ev.key == NEWLINE)) { if (ev.shiftDown()) nameField.requestFocus(); else OKButton.requestFocus(); } } // keyPressPasswordField