gumbo.graphic.input.impl.swing
Class SwingSensors

java.lang.Object
  |
  +--gumbo.graphic.input.impl.swing.SwingSensors

public class SwingSensors
extends java.lang.Object

Constants and utilities related to Swing sensors. Note that all Swing sensors using a glass pane must call enableSensorGlass() and disableSensorGlass(). Todo: Create a SwingGlassSensor class that monitors a single glass, and all SwingMouseSensors with the same glass use the same glass sensor delegate.

Version:
$Revision: 1.2 $
Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.

Method Summary
static int buttonMaskBits(int maskBits)
          Returns the Swing button mask bits (InputEvent.BUTTON???_DOWN_MASK) that are in a Swing modifier mask bit value.
static java.lang.Object fromKeyCode(int code)
          Returns the Gumbo key flag (KeyboardSensors.KEY_???) corresponding to a Swing key code (KeyEvent.VK_???).
static java.lang.Object fromModifierMask(int mask)
          Returns the Gumbo sensor flag (MouseSensors.BUTTON_???, KeyboardSensors.KEY_???) corresponding to a Swing modifier mask (InputEvent.???_DOWN_MASK).
static java.util.Collection fromModifierMaskBits(int maskBits, java.util.Collection retVal)
          Returns the modifier mask bits (InputEvent.???_DOWN_MASK) corresponding to a group of sensor flags (MouseSensors.BUTTON_???, KeyboardSensors.KEY_???).
static int keyMaskBits(int maskBits)
          Returns the Swing modifier key mask bits (InputEvent.???_DOWN_MASK) that are in a Swing modifier mask bit value.
static int toKeyCode(java.lang.Object flag)
          Returns the Swing key code (KeyEvent.VK_???) corresponding to a Gumbo key flag (KeyboardSensors.KEY_???).
static int toModifierMask(java.lang.Object flag)
          Returns the Swing modifier mask (InputEvent.???_DOWN_MASK) corresponding to a Gumbo sensor flag (MouseSensors.BUTTON_???, KeyboardSensors.KEY_???).
static int toModifierMaskBits(java.util.Collection flags)
          Returns the Swing modifier mask bits (InputEvent.???_DOWN_MASK) corresponding to a group of Gumbo sensor flags (MouseSensors.BUTTON_???, KeyboardSensors.KEY_???).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

buttonMaskBits

public static int buttonMaskBits(int maskBits)
Returns the Swing button mask bits (InputEvent.BUTTON???_DOWN_MASK) that are in a Swing modifier mask bit value.

Returns:
Swing button mask bits.

keyMaskBits

public static int keyMaskBits(int maskBits)
Returns the Swing modifier key mask bits (InputEvent.???_DOWN_MASK) that are in a Swing modifier mask bit value.

Returns:
Swing key mask bits.

toModifierMask

public static int toModifierMask(java.lang.Object flag)
Returns the Swing modifier mask (InputEvent.???_DOWN_MASK) corresponding to a Gumbo sensor flag (MouseSensors.BUTTON_???, KeyboardSensors.KEY_???).

Returns:
Swing modifier mask. 0 if none found.

toModifierMaskBits

public static int toModifierMaskBits(java.util.Collection flags)
Returns the Swing modifier mask bits (InputEvent.???_DOWN_MASK) corresponding to a group of Gumbo sensor flags (MouseSensors.BUTTON_???, KeyboardSensors.KEY_???).

Returns:
Swing modifier mask bits. 0 if none found.

fromModifierMask

public static java.lang.Object fromModifierMask(int mask)
Returns the Gumbo sensor flag (MouseSensors.BUTTON_???, KeyboardSensors.KEY_???) corresponding to a Swing modifier mask (InputEvent.???_DOWN_MASK).

Returns:
Gumbo sensor flag. Null if none found.

fromModifierMaskBits

public static java.util.Collection fromModifierMaskBits(int maskBits,
                                                        java.util.Collection retVal)
Returns the modifier mask bits (InputEvent.???_DOWN_MASK) corresponding to a group of sensor flags (MouseSensors.BUTTON_???, KeyboardSensors.KEY_???).

Returns:
Gumbo sensor flags (Object). Empty if none found.

toKeyCode

public static int toKeyCode(java.lang.Object flag)
Returns the Swing key code (KeyEvent.VK_???) corresponding to a Gumbo key flag (KeyboardSensors.KEY_???).

Returns:
Swing key code. -1 if none found.

fromKeyCode

public static java.lang.Object fromKeyCode(int code)
Returns the Gumbo key flag (KeyboardSensors.KEY_???) corresponding to a Swing key code (KeyEvent.VK_???).

Returns:
Gumbo key flag. Null if none found.