fr.emn.reactiveinput.system
Class AWTKeyboardDisabler

java.lang.Object
  extended byjava.awt.EventQueue
      extended byfr.emn.reactiveinput.system.AWTKeyboardDisabler
All Implemented Interfaces:
StdInputDisabler

public class AWTKeyboardDisabler
extends java.awt.EventQueue
implements StdInputDisabler

Disables key events for the whole java application. Only Alt+C events are enabled. Individual frame disabling is not supported, so calling install() with a non-null frame won't work. An AWTEventListener can be provided as context in install() method for listening to keyboard events BEFORE they are blocked.


Field Summary
protected static int install_counter
           
protected  boolean installed
           
protected  java.awt.event.AWTEventListener monitor
           
 
Constructor Summary
AWTKeyboardDisabler()
           
 
Method Summary
 void doDisable()
          Disables input for a short amount of time.
 boolean install(javax.swing.JFrame frame, java.lang.Object context)
          Deactivates standard input handling and/or feedback on the given frame.
 boolean uninstall()
          Reactivates standard input handling in the context specified in install().
 
Methods inherited from class java.awt.EventQueue
dispatchEvent, getCurrentEvent, getMostRecentEventTime, getNextEvent, invokeAndWait, invokeLater, isDispatchThread, peekEvent, peekEvent, pop, postEvent, push
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

install_counter

protected static int install_counter

monitor

protected java.awt.event.AWTEventListener monitor

installed

protected boolean installed
Constructor Detail

AWTKeyboardDisabler

public AWTKeyboardDisabler()
Method Detail

install

public boolean install(javax.swing.JFrame frame,
                       java.lang.Object context)
Description copied from interface: StdInputDisabler
Deactivates standard input handling and/or feedback on the given frame.

Specified by:
install in interface StdInputDisabler
Parameters:
frame - must be null.
context - An AWTEventListener object can be provided for listening to keyboard events BEFORE they are blocked.
Returns:

uninstall

public boolean uninstall()
Description copied from interface: StdInputDisabler
Reactivates standard input handling in the context specified in install().

Specified by:
uninstall in interface StdInputDisabler
Returns:
false if there is nothing to uninstall.

doDisable

public void doDisable()
Description copied from interface: StdInputDisabler
Disables input for a short amount of time. Some classes require continuously calling this method between install() and uninstall().

Specified by:
doDisable in interface StdInputDisabler