Example usage for java.awt.event KeyEvent VK_PLUS

List of usage examples for java.awt.event KeyEvent VK_PLUS

Introduction

In this page you can find the example usage for java.awt.event KeyEvent VK_PLUS.

Prototype

int VK_PLUS

To view the source code for java.awt.event KeyEvent VK_PLUS.

Click Source Link

Document

Constant for the "+" key.

Usage

From source file:org.squidy.nodes.Wiimote.java

/**
 * Adds a <code>CoreButtonListener</code> to the parameter mote.
 * //w w  w  .  j  a  v  a 2  s .co  m
 * @param mote
 *            The mote that gets the core button listener.
 */
private CoreButtonListener createCoreButtonListener() {
    return new CoreButtonListener() {

        /*
         * (non-Javadoc)
         * 
         * @see motej.event.CoreButtonListener#buttonPressed(motej.event.CoreButtonEvent)
         */
        public void buttonPressed(CoreButtonEvent evt) {
            // Propagate buttons as button events.
            publish(new DataButton(Wiimote.class, DataButton.BUTTON_1, evt.isButtonAPressed()));
            // TODO Roman: Change button back to BUTTON_3.
            publish(new DataButton(Wiimote.class, DataButton.BUTTON_10, evt.isButtonBPressed()));

            publish(new DataButton(Wiimote.class, DataButton.BUTTON_A, evt.isButtonAPressed()));
            publish(new DataButton(Wiimote.class, DataButton.BUTTON_B, evt.isButtonBPressed()));

            // Home button pressed results in a VK_H key event.
            publish(new DataKey(Wiimote.class, KeyEvent.VK_H, evt.isButtonHomePressed()));

            // Propagate pad keys. -> UP, RIGHT, DOWN, LEFT result in VK_UP,
            // VK_RIGHT, VK_DOWN, VK_LEFT.
            publish(new DataKey(Wiimote.class, KeyEvent.VK_UP, evt.isDPadUpPressed()));
            publish(new DataKey(Wiimote.class, KeyEvent.VK_RIGHT, evt.isDPadRightPressed()));
            publish(new DataKey(Wiimote.class, KeyEvent.VK_DOWN, evt.isDPadDownPressed()));
            publish(new DataKey(Wiimote.class, KeyEvent.VK_LEFT, evt.isDPadLeftPressed()));

            // Button (-) and (+) pressed -> result in VK_MINUS and VK_PLUS
            // key event.
            publish(new DataKey(Wiimote.class, KeyEvent.VK_MINUS, evt.isButtonMinusPressed()));
            publish(new DataKey(Wiimote.class, KeyEvent.VK_PLUS, evt.isButtonPlusPressed()));
            publish(new DataButton(Wiimote.class, DataButton.BUTTON_PLUS, evt.isButtonPlusPressed()));

            // Button (1) and (2) pressed -> result in VK_1 and VK_2 key
            // event.
            publish(new DataKey(Wiimote.class, KeyEvent.VK_1, evt.isButtonOnePressed()));
            publish(new DataKey(Wiimote.class, KeyEvent.VK_2, evt.isButtonTwoPressed()));
        }
    };
}