gzz.util
Class InputEventUtil

java.lang.Object
  |
  +--gzz.util.InputEventUtil

public class InputEventUtil
extends java.lang.Object

Hacks to work around Java's inconsistent, ideosyncratic key events. Also generates meaningful names for key events.

Everything in this class is static, but there are (static) variables for the "detected state of the system": e.g., how this Java VM handles umlauts.

Currently, detects whether we get umlauts through KEY_PRESSED; if not, invokes them at KEY_TYPED.


Field Summary
static boolean dbg
           
static java.lang.String rcsid
           
 
Constructor Summary
InputEventUtil()
           
 
Method Summary
static java.lang.String getKeyEventName(java.awt.event.KeyEvent k)
           
static java.lang.String getKeyEventName2(java.awt.event.KeyEvent k)
           
static java.awt.event.KeyEvent keyEventHack(java.awt.event.KeyEvent e)
          Do the hacks on this key event.
static java.awt.event.MouseEvent mouseEventHack(java.awt.event.MouseEvent e)
          Do the hacks on this mouse event.
static void reset()
          Reset the state, so as if the program was fired up anew.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rcsid

public static final java.lang.String rcsid
See Also:
Constant Field Values

dbg

public static boolean dbg
Constructor Detail

InputEventUtil

public InputEventUtil()
Method Detail

getKeyEventName

public static java.lang.String getKeyEventName(java.awt.event.KeyEvent k)

getKeyEventName2

public static java.lang.String getKeyEventName2(java.awt.event.KeyEvent k)

keyEventHack

public static final java.awt.event.KeyEvent keyEventHack(java.awt.event.KeyEvent e)
Do the hacks on this key event. Currently, does the umlaut trick, as well as the testing whether we need it.


mouseEventHack

public static final java.awt.event.MouseEvent mouseEventHack(java.awt.event.MouseEvent e)
Do the hacks on this mouse event. Currently, sets button 3 if Meta is pressed, and sets button 1 if no button is pressed. (These are important for Macintosh.) No environment detection of any sort is done.


reset

public static void reset()
Reset the state, so as if the program was fired up anew. This sets back all information gathered about the Java VM so far and re-initializes the class. Currently this is used for testing purposes only: the TestUmlauts JUnit test suite needs to be able to run different tests emulating different kinds of VMs.