Directory

← Back

KeycodeListener

A simple listener for a sequence of key presses.

Author

Rating

Popularity

<100

A simple listener for keyboard events. It takes a array of key codes as input, and fires an callback when the sequence is typed in the correct order.

Sample code

import com.google.gwt.event.dom.client.KeyCodes;

        // listens to the Konami code (? ? ? ? ? ? ? ? B A)
        final KeycodeListener kl = new KeycodeListener();
       
        kl.setKeycode(new int[] { KeyCodes.KEY_UP, KeyCodes.KEY_UP,
                KeyCodes.KEY_DOWN, KeyCodes.KEY_DOWN, KeyCodes.KEY_LEFT,
                KeyCodes.KEY_RIGHT, KeyCodes.KEY_LEFT, KeyCodes.KEY_RIGHT, 66,
                65 });

        kl.setCallback(new KeycodeListener.CodeCallback() {

            @Override
            public void codeFired() {
                kl.getWindow().showNotification("Great success!");
            }
        });

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Released
2010-01-22
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 6.2+
Browser
Internet Explorer
Internet Explorer
Internet Explorer
Firefox
Safari

KeycodeListener - Vaadin Add-on Directory

A simple listener for a sequence of key presses. KeycodeListener - Vaadin Add-on Directory
A simple listener for keyboard events. It takes a array of key codes as input, and fires an callback when the sequence is typed in the correct order.
Source code
Demo
Discussion Forum

KeycodeListener version 1.0
null

Online