com.melloware.jintellitype
Class JIntellitype
java.lang.Object
com.melloware.jintellitype.JIntellitype
- All Implemented Interfaces:
- JIntellitypeConstants
public final class JIntellitype
- extends Object
- implements JIntellitypeConstants
JIntellitype A Java Implementation for using the Windows API Intellitype
commands and the RegisterHotKey and UnRegisterHotkey API calls for globally
responding to key events. Intellitype are commands that are using for Play,
Stop, Next on Media keyboards or some laptops that have those special keys.
JIntellitype class that is used to call Windows API calls using the
JIntellitype.dll.
This file comes with native code in JINTELLITYPE.DLL The DLL should go in
C:/WINDOWS/SYSTEM or in your current directory
Copyright (c) 1999-2008
Melloware, Inc.
- Version:
- 1.3.1
- Author:
- Emil A. Lefkof III
| Fields inherited from interface com.melloware.jintellitype.JIntellitypeConstants |
APPCOMMAND_BASS_BOOST, APPCOMMAND_BASS_DOWN, APPCOMMAND_BASS_UP, APPCOMMAND_BROWSER_BACKWARD, APPCOMMAND_BROWSER_FAVOURITES, APPCOMMAND_BROWSER_FORWARD, APPCOMMAND_BROWSER_HOME, APPCOMMAND_BROWSER_REFRESH, APPCOMMAND_BROWSER_SEARCH, APPCOMMAND_BROWSER_STOP, APPCOMMAND_CLOSE, APPCOMMAND_COPY, APPCOMMAND_CORRECTION_LIST, APPCOMMAND_CUT, APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE, APPCOMMAND_FIND, APPCOMMAND_FORWARD_MAIL, APPCOMMAND_HELP, APPCOMMAND_LAUNCH_APP1, APPCOMMAND_LAUNCH_APP2, APPCOMMAND_LAUNCH_MAIL, APPCOMMAND_LAUNCH_MEDIA_SELECT, APPCOMMAND_MEDIA_NEXTTRACK, APPCOMMAND_MEDIA_PLAY_PAUSE, APPCOMMAND_MEDIA_PREVIOUSTRACK, APPCOMMAND_MEDIA_STOP, APPCOMMAND_MIC_ON_OFF_TOGGLE, APPCOMMAND_MICROPHONE_VOLUME_DOWN, APPCOMMAND_MICROPHONE_VOLUME_MUTE, APPCOMMAND_MICROPHONE_VOLUME_UP, APPCOMMAND_NEW, APPCOMMAND_OPEN, APPCOMMAND_PASTE, APPCOMMAND_PRINT, APPCOMMAND_REDO, APPCOMMAND_REPLY_TO_MAIL, APPCOMMAND_SAVE, APPCOMMAND_SEND_MAIL, APPCOMMAND_SPELL_CHECK, APPCOMMAND_TREBLE_DOWN, APPCOMMAND_TREBLE_UP, APPCOMMAND_UNDO, APPCOMMAND_VOLUME_DOWN, APPCOMMAND_VOLUME_MUTE, APPCOMMAND_VOLUME_UP, ERROR_MESSAGE, MOD_ALT, MOD_CONTROL, MOD_SHIFT, MOD_WIN |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getInstance
public static JIntellitype getInstance()
- Gets the singleton instance of the JIntellitype object.
But the possibility of creation of more instance is only before the
instance is created. Since all code defined inside getInstance method is
in the synchronized block, even the subsequent requests will also come and
wait in the synchronized block. This is a performance issue. The same can
be solved using double-checked lock. Following is the implementation of
Singleton with lazy initialization and double-checked lock.
- Returns:
- an instance of JIntellitype class
addHotKeyListener
public void addHotKeyListener(HotkeyListener listener)
- Adds a listener for hotkeys.
- Parameters:
listener - the HotKeyListener to be added
addIntellitypeListener
public void addIntellitypeListener(IntellitypeListener listener)
- Adds a listener for intellitype commands.
- Parameters:
listener - the IntellitypeListener to be added
cleanUp
public void cleanUp()
- Cleans up all resources used by JIntellitype.
registerHotKey
public void registerHotKey(int identifier,
int modifier,
int keycode)
- Registers a Hotkey with windows. This combination will be responded to by
all registered HotKeyListeners. Uses the JIntellitypeConstants for MOD,
ALT, CTRL, and WINDOWS keys.
- Parameters:
identifier - a unique identifier for this key combinationmodifier - MOD_SHIFT, MOD_ALT, MOD_CONTROL, MOD_WIN from
JIntellitypeConstants, or 0 if no modifier neededkeycode - the key to respond to in Ascii integer, 65 for A
registerSwingHotKey
public void registerSwingHotKey(int identifier,
int modifier,
int keycode)
- Registers a Hotkey with windows. This combination will be responded to by
all registered HotKeyListeners. Use the Swing InputEvent constants from
java.awt.InputEvent.
- Parameters:
identifier - a unique identifier for this key combinationmodifier - InputEvent.SHIFT_MASK, InputEvent.ALT_MASK,
InputEvent.CTRL_MASK, or 0 if no modifier neededkeycode - the key to respond to in Ascii integer, 65 for A
registerHotKey
public void registerHotKey(int identifier,
String modifierAndKeyCode)
- Registers a Hotkey with windows. This combination will be responded to by
all registered HotKeyListeners. Use the identifiers CTRL, SHIFT, ALT
and/or WIN.
- Parameters:
identifier - a unique identifier for this key combinationmodifierAndKeyCode - String with modifiers separated by + and keycode
(e.g. CTRL+SHIFT+A)- See Also:
registerHotKey(int, int, int),
registerSwingHotKey(int, int, int)
removeHotKeyListener
public void removeHotKeyListener(HotkeyListener listener)
- Removes a listener for hotkeys.
removeIntellitypeListener
public void removeIntellitypeListener(IntellitypeListener listener)
- Removes a listener for intellitype commands.
unregisterHotKey
public void unregisterHotKey(int identifier)
- Unregisters a previously registered Hotkey identified by its unique
identifier.
- Parameters:
identifier - the unique identifer of this Hotkey
checkInstanceAlreadyRunning
public static boolean checkInstanceAlreadyRunning(String appTitle)
- Checks to see if this application is already running.
- Parameters:
appTitle - the name of the application to check for
- Returns:
- true if running, false if not running
isJIntellitypeSupported
public static boolean isJIntellitypeSupported()
- Checks to make sure the OS is a Windows flavor and that the JIntellitype
DLL is found in the path and the JDK is 32 bit not 64 bit. The DLL
currently only supports 32 bit JDK.
- Returns:
- true if Jintellitype may be used, false if not
onHotKey
protected void onHotKey(int identifier)
- Notifies all listeners that Hotkey was pressed.
- Parameters:
identifier - the unique identifier received
onIntellitype
protected void onIntellitype(int command)
- Notifies all listeners that Intellitype command was received.
- Parameters:
command - the unique WM_APPCOMMAND received
swingToIntelliType
protected static int swingToIntelliType(int swingKeystrokeModifier)
- Swing modifier value to Jintellipad conversion. If no conversion needed
just return the original value. This lets users pass either the original
JIntellitype constants or Swing InputEvent constants.
- Parameters:
swingKeystrokeModifier - the Swing KeystrokeModifier to check
- Returns:
- Jintellitype the JIntellitype modifier value
Copyright © 1999-2008 Melloware Inc. All Rights Reserved.