/**
* debugging tool to track keystrokes
*/
protected static void dumpKeyEvent( KeyEvent e )
{
out.print ( " ID=" + (int)e .getID() + " " );
switch ( e .getID() )
{
case KeyEvent.KEY_TYPED :
out.print ("KeyEvent.KEY_TYPED " );
break;
case KeyEvent.KEY_PRESSED:
out.print ("KeyEvent.KEY_PRESSED " );
break;
case KeyEvent.KEY_RELEASED:
out.print ("KeyEvent.KEY_RELEASED" );
break;
default:
break;
}
out.print ( " raw KeyCode=\"" + (char)e .getKeyCode() + "\" " + (int)e .getKeyCode());
out.print ( " cooked KeyChar=\"" + (char)e .getKeyChar() + "\" " + (int)e .getKeyChar());
int mods = e.getModifiers();
if ( ( mods & InputEvent.ALT_MASK ) != 0 ) out.print (" ALT_MASK" );
if ( ( mods & InputEvent.CTRL_MASK ) != 0 ) out.print (" CTRL_MASK" );
if ( ( mods & InputEvent.META_MASK ) != 0 ) out.print (" META_MASK" );
if ( ( mods & InputEvent.SHIFT_MASK ) != 0 ) out.print (" SHIFT_MASK" );
out.println();
}
/**
* debugging tool to track mouse clicks
*/
protected static void dumpMouseEvent (MouseEvent e)
{
out.print ( " ID=" + (int)e .getID() + " " );
switch ( e .getID() )
{
case MouseEvent.MOUSE_CLICKED :
out.print ("MouseEvent.MOUSE_CLICKED " );
break;
case MouseEvent.MOUSE_ENTERED :
out.print ("MouseEvent.MOUSE_ENTERED " );
break;
case MouseEvent.MOUSE_EXITED :
out.print ("MouseEvent.MOUSE_EXITED " );
break;
case MouseEvent.MOUSE_PRESSED :
out.print ("MouseEvent.MOUSE_PRESSED " );
break;
case MouseEvent.MOUSE_RELEASED :
out.print ("MouseEvent.MOUSE_RELEASED" );
break;
default:
break;
}
int mods = e.getModifiers();
if ( ( mods & InputEvent.ALT_MASK ) != 0 ) out.print (" ALT_MASK" );
if ( ( mods & InputEvent.BUTTON1_MASK ) != 0 ) out.print (" BUTTON1_MASK" );
if ( ( mods & InputEvent.BUTTON2_MASK ) != 0 ) out.print (" BUTTON2_MASK" );
if ( ( mods & InputEvent.BUTTON3_MASK ) != 0 ) out.print (" BUTTON3_MASK" );
if ( ( mods & InputEvent.CTRL_MASK ) != 0 ) out.print (" CTRL_MASK" );
if ( ( mods & InputEvent.META_MASK ) != 0 ) out.print (" META_MASK" );
if ( ( mods & InputEvent.SHIFT_MASK ) != 0 ) out.print (" SHIFT_MASK" );
out.print (" (" + e.getX() + "," + e.getY() + ")" );
out.println();
}