jxgrabkey
Class JXGrabKey

java.lang.Object
  extended by jxgrabkey.JXGrabKey

public class JXGrabKey
extends Object

This class implements the API access. All public methods are synchronized, hence thread-safe.


Method Summary
 void addHotkeyListener(HotkeyListener listener)
          Adds a HotkeyListener.
 void cleanUp()
          Unregisters all hotkeys, removes all HotkeyListeners, stops the main listen loop and deinitializes the singleton.
static void debugCallback(String debugmessage)
          Either gives debug messages to a HotkeyListenerDebugEnabled if registered, or prints to console otherwise.
static void fireKeyEvent(int id)
          Notifies HotkeyListeners about a received KeyEvent.
static JXGrabKey getInstance()
          Retrieves the singleton.
 void registerAwtHotkey(int id, int awtMask, int awtKey)
          Converts an AWT hotkey into a X11 hotkey and registers it.
 void registerX11Hotkey(int id, int x11Mask, int x11Keysym)
          Registers a X11 hotkey.
 void removeHotkeyListener(HotkeyListener listener)
          Removes a HotkeyListener.
static void setDebugOutput(boolean enabled)
          Enables/Disables printing of debug messages.
 void unregisterHotKey(int id)
          This method unregisters a hotkey.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static JXGrabKey getInstance()
Retrieves the singleton. Initializes it, if not yet done.

Returns:

addHotkeyListener

public void addHotkeyListener(HotkeyListener listener)
Adds a HotkeyListener.

Parameters:
listener -

removeHotkeyListener

public void removeHotkeyListener(HotkeyListener listener)
Removes a HotkeyListener.

Parameters:
listener -

cleanUp

public void cleanUp()
Unregisters all hotkeys, removes all HotkeyListeners, stops the main listen loop and deinitializes the singleton.


registerX11Hotkey

public void registerX11Hotkey(int id,
                              int x11Mask,
                              int x11Keysym)
                       throws HotkeyConflictException
Registers a X11 hotkey.

Parameters:
id -
x11Mask -
x11Keysym -
Throws:
HotkeyConflictException

registerAwtHotkey

public void registerAwtHotkey(int id,
                              int awtMask,
                              int awtKey)
                       throws HotkeyConflictException
Converts an AWT hotkey into a X11 hotkey and registers it.

Parameters:
id -
awtMask -
awtKey -
Throws:
HotkeyConflictException

setDebugOutput

public static void setDebugOutput(boolean enabled)
Enables/Disables printing of debug messages.

Parameters:
enabled -

fireKeyEvent

public static void fireKeyEvent(int id)
Notifies HotkeyListeners about a received KeyEvent. This method is used by the C++ code. Do not use this method from externally.

Parameters:
id -

debugCallback

public static void debugCallback(String debugmessage)
Either gives debug messages to a HotkeyListenerDebugEnabled if registered, or prints to console otherwise. Does only print if debug is enabled. This method is both used by the C++ and Java code, so it should not be synchronized. Don't use this method from externally.

Parameters:
debugmessage -

unregisterHotKey

public void unregisterHotKey(int id)
This method unregisters a hotkey. If the hotkey is not yet registered, nothing will happen.

Parameters:
id -