Saturday, June 14, 2008

GWT: keyboard listener

It is use friendly to add keyboard listeners to UI buttons, below is the how to:


passwordInput.addKeyboardListener(new KeyboardListenerAdapter()
{
public void onKeyPress(Widget sender, char keyCode, int modifiers)
{
// Check for Enter key
if ((keyCode == 13) && (modifiers == 0))
{ attemptLogin(); }
} });