Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.globalshortcut
Class NativeKeyboardHook

java.lang.Object
  extended by net.java.sip.communicator.impl.globalshortcut.NativeKeyboardHook

public class NativeKeyboardHook
extends Object

Native hook for keyboard. It is used to notify a NativeKeyboardHookDelegate for key (even if key are pressed when application is not in foreground).

Author:
Sebastien Vincent

Constructor Summary
NativeKeyboardHook()
          Constructor.
 
Method Summary
 void detectSpecialKeyPress(boolean enable)
          Detect special key press.
 boolean isSpecialKeyDetection()
          Returns whether or not special key detection is enabled.
 boolean registerShortcut(int keycode, int modifiers)
          Register a shortcut.
 boolean registerSpecial(int keycode)
          Register a special key shortcut (for example key coming from headset).
 void setDelegate(NativeKeyboardHookDelegate delegate)
          Set delegate object for event notification.
 void start()
          Start the NativeKeyboardHook.
 void stop()
          Stop the NativeKeyboardHook.
 void unregisterShortcut(int keycode, int modifiers)
          Unregister a shortcut.
 void unregisterSpecial(int keycode)
          Unregister a special key shortcut (for example key coming from headset).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NativeKeyboardHook

public NativeKeyboardHook()
Constructor.

Method Detail

start

public void start()
Start the NativeKeyboardHook.


stop

public void stop()
Stop the NativeKeyboardHook.


setDelegate

public void setDelegate(NativeKeyboardHookDelegate delegate)
Set delegate object for event notification.

Parameters:
delegate - delegate object

registerShortcut

public boolean registerShortcut(int keycode,
                                int modifiers)
Register a shortcut.

Parameters:
keycode - keycode of the shortcut
modifiers - modifiers (CTRL, ALT, ...)
Returns:
true if success, false otherwise

unregisterShortcut

public void unregisterShortcut(int keycode,
                               int modifiers)
Unregister a shortcut.

Parameters:
keycode - keycode of the shortcut
modifiers - modifiers (CTRL, ALT, ...)

registerSpecial

public boolean registerSpecial(int keycode)
Register a special key shortcut (for example key coming from headset).

Parameters:
keycode - keycode of the shortcut
Returns:
true if success, false otherwise

unregisterSpecial

public void unregisterSpecial(int keycode)
Unregister a special key shortcut (for example key coming from headset).

Parameters:
keycode - keycode of the shortcut

detectSpecialKeyPress

public void detectSpecialKeyPress(boolean enable)
Detect special key press.

Parameters:
enable - enable or not the special key press detection.

isSpecialKeyDetection

public boolean isSpecialKeyDetection()
Returns whether or not special key detection is enabled.

Returns:
true if special key detection is enabled, false otherwise

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.