Module com.github.kwhat.jnativehook
Class NativeHookDemo
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
com.github.kwhat.jnativehook.example.NativeHookDemo
- All Implemented Interfaces:
NativeKeyListener,NativeMouseInputListener,NativeMouseListener,NativeMouseMotionListener,NativeMouseWheelListener,ActionListener,ItemListener,WindowListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,RootPaneContainer,WindowConstants
public class NativeHookDemo
extends JFrame
implements ActionListener, ItemListener, NativeKeyListener, NativeMouseInputListener, NativeMouseWheelListener, WindowListener
A demonstration of how to use the JNativeHook library.
- Since:
- 1.0
- Version:
- 2.0
- Author:
- Alexander Barker (alex@1stleg.com)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrameNested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrameNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
Fields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSORFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidstatic voidThe demo project entry point.voidInvoked when a key has been pressed.voidInvoked when a key has been released.voidInvoked when a key has been typed.voidInvoked when a mouse button has been clicked (pressed and released) without being moved.voidInvoked when the mouse has been moved while a button is depressed.voidInvoked when the mouse has been moved.voidInvoked when a mouse button has been pressedvoidInvoked when a mouse button has been releasedvoidInvoked when the mouse wheel is rotated.voidUnimplementedvoidFinalize and exit the program.voidUnimplementedvoidUnimplementedvoidUnimplementedvoidUnimplementedvoidDisplay information about the native keyboard and mouse along with any errors that may have occurred.Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateMethods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecoratedMethods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFrontMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.MenuContainer
getFont, postEvent
-
Constructor Details
-
NativeHookDemo
public NativeHookDemo()Instantiates a new native hook demo.
-
-
Method Details
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener- See Also:
-
itemStateChanged
- Specified by:
itemStateChangedin interfaceItemListener- See Also:
-
nativeKeyPressed
Description copied from interface:NativeKeyListenerInvoked when a key has been pressed.- Specified by:
nativeKeyPressedin interfaceNativeKeyListener- Parameters:
e- the native key event.- See Also:
-
nativeKeyReleased
Description copied from interface:NativeKeyListenerInvoked when a key has been released.- Specified by:
nativeKeyReleasedin interfaceNativeKeyListener- Parameters:
e- the native key event.- See Also:
-
nativeKeyTyped
Description copied from interface:NativeKeyListenerInvoked when a key has been typed.- Specified by:
nativeKeyTypedin interfaceNativeKeyListener- Parameters:
e- the native key event.- See Also:
-
nativeMouseClicked
Description copied from interface:NativeMouseListenerInvoked when a mouse button has been clicked (pressed and released) without being moved.- Specified by:
nativeMouseClickedin interfaceNativeMouseListener- Parameters:
e- the native mouse event.- See Also:
-
nativeMousePressed
Description copied from interface:NativeMouseListenerInvoked when a mouse button has been pressed- Specified by:
nativeMousePressedin interfaceNativeMouseListener- Parameters:
e- the native mouse event.- See Also:
-
nativeMouseReleased
Description copied from interface:NativeMouseListenerInvoked when a mouse button has been released- Specified by:
nativeMouseReleasedin interfaceNativeMouseListener- Parameters:
e- the native mouse event.- See Also:
-
nativeMouseMoved
Description copied from interface:NativeMouseMotionListenerInvoked when the mouse has been moved.- Specified by:
nativeMouseMovedin interfaceNativeMouseMotionListener- Parameters:
e- the native mouse event.- See Also:
-
nativeMouseDragged
Description copied from interface:NativeMouseMotionListenerInvoked when the mouse has been moved while a button is depressed.- Specified by:
nativeMouseDraggedin interfaceNativeMouseMotionListener- Parameters:
e- the native mouse event- See Also:
-
nativeMouseWheelMoved
Description copied from interface:NativeMouseWheelListenerInvoked when the mouse wheel is rotated.- Specified by:
nativeMouseWheelMovedin interfaceNativeMouseWheelListener- Parameters:
e- the native mouse wheel event.- See Also:
-
windowActivated
Unimplemented- Specified by:
windowActivatedin interfaceWindowListener- See Also:
-
windowClosing
Unimplemented- Specified by:
windowClosingin interfaceWindowListener- See Also:
-
windowDeactivated
Unimplemented- Specified by:
windowDeactivatedin interfaceWindowListener- See Also:
-
windowDeiconified
Unimplemented- Specified by:
windowDeiconifiedin interfaceWindowListener- See Also:
-
windowIconified
Unimplemented- Specified by:
windowIconifiedin interfaceWindowListener- See Also:
-
windowOpened
Display information about the native keyboard and mouse along with any errors that may have occurred.- Specified by:
windowOpenedin interfaceWindowListener- See Also:
-
windowClosed
Finalize and exit the program.- Specified by:
windowClosedin interfaceWindowListener- See Also:
-
main
The demo project entry point.- Parameters:
args- unused.
-