11/* JNativeHook: Global keyboard and mouse hooking for Java. 
2-  * Copyright (C) 2006-2018 Alexander Barker.   All Rights Received. 
2+  * Copyright (C) 2006-2018 Alexander Barker. All Rights Received. 
33 * https://github.com/kwhat/jnativehook/ 
44 *  
55 * JNativeHook is free software: you can redistribute it and/or modify 
99 * 
1010 * JNativeHook is distributed in the hope that it will be useful, 
1111 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
12-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the 
12+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
1313 * GNU General Public License for more details. 
1414 * 
1515 * You should have received a copy of the GNU Lesser General Public License 
16-  * along with this program.   If not, see <http://www.gnu.org/licenses/>. 
16+  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
1717 */ 
1818package  org .jnativehook ;
1919
3030import  java .io .File ;
3131import  java .util .Iterator ;
3232import  java .util .concurrent .ExecutorService ;
33+ import  java .util .logging .Level ;
3334import  java .util .logging .Logger ;
3435
3536/** 
@@ -50,7 +51,13 @@ public class GlobalScreen {
5051	/** 
5152	 * Logging service for the native library. 
5253	 */ 
53- 	protected  static  Logger  log  = Logger .getLogger (GlobalScreen .class .getPackage ().getName ());
54+ 	protected  static  Logger  logger  = Logger .getLogger (GlobalScreen .class .getPackage ().getName ());
55+ 	static  {
56+ 		logger .setLevel (Level .WARNING );
57+ 		logger .setUseParentHandlers (false );
58+ 	}
59+ 	
60+ 	protected  GlobalScreen () { }
5461
5562	/** 
5663	 * The service to control the hook. 
@@ -91,7 +98,7 @@ public class GlobalScreen {
9198			}
9299			catch  (Exception  e ) {
93100				// There was a problem instantiating the library loader. 
94- 				log .severe (e .getMessage ());
101+ 				logger .severe (e .getMessage ());
95102
96103				throw  new  UnsatisfiedLinkError (e .getMessage ());
97104			}
@@ -130,13 +137,10 @@ public class GlobalScreen {
130137		}
131138	}
132139
133- 
134- 	protected  GlobalScreen () { }
135- 
136140	/** 
137141	 * Adds the specified native key listener to receive key events from the 
138- 	 * native system. If listener is null, no exception is thrown and no action  
139- 	 * is performed. 
142+ 	 * native system. 
143+ 	 * If listener is null, no exception is thrown and no action  is performed. 
140144	 * 
141145	 * @param listener a native key listener object 
142146	 */ 
@@ -149,8 +153,8 @@ public static void addNativeKeyListener(NativeKeyListener listener) {
149153	/** 
150154	 * Removes the specified native key listener so that it no longer receives 
151155	 * key events from the native system. This method performs no function if 
152- 	 * the listener specified by the argument was not previously added.  If  
153- 	 * listener is null, no exception is thrown and no action is performed. 
156+ 	 * the listener specified by the argument was not previously added.I  
157+ 	 * If  listener is null, no exception is thrown and no action is performed. 
154158	 * 
155159	 * @param listener a native key listener object 
156160	 */ 
@@ -162,8 +166,8 @@ public static void removeNativeKeyListener(NativeKeyListener listener) {
162166
163167	/** 
164168	 * Adds the specified native mouse listener to receive mouse events from the 
165- 	 * native system. If listener is null, no exception is thrown and no action  
166- 	 * is performed. 
169+ 	 * native system. 
170+ 	 * If listener is null, no exception is thrown and no action  is performed. 
167171	 * 
168172	 * @param listener a native mouse listener object 
169173	 */ 
@@ -176,8 +180,8 @@ public static void addNativeMouseListener(NativeMouseListener listener) {
176180	/** 
177181	 * Removes the specified native mouse listener so that it no longer receives 
178182	 * mouse events from the native system. This method performs no function if 
179- 	 * the listener specified by the argument was not previously added.  If  
180- 	 * listener is null, no exception is thrown and no action is performed. 
183+ 	 * the listener specified by the argument was not previously added. 
184+ 	 * If  listener is null, no exception is thrown and no action is performed. 
181185	 * 
182186	 * @param listener a native mouse listener object 
183187	 */ 
@@ -189,8 +193,8 @@ public static void removeNativeMouseListener(NativeMouseListener listener) {
189193
190194	/** 
191195	 * Adds the specified native mouse motion listener to receive mouse motion 
192- 	 * events from the native system. If listener is null, no exception is  
193- 	 * thrown and no action is performed. 
196+ 	 * events from the native system. 
197+ 	 * If listener is null, no exception is  thrown and no action is performed. 
194198	 * 
195199	 * @param listener a native mouse motion listener object 
196200	 */ 
@@ -204,8 +208,8 @@ public static void addNativeMouseMotionListener(NativeMouseMotionListener listen
204208	 * Removes the specified native mouse motion listener so that it no longer 
205209	 * receives mouse motion events from the native system. This method performs 
206210	 * no function if the listener specified by the argument was not previously 
207- 	 * added.  If listener is null, no exception is thrown and no action is  
208- 	 * performed. 
211+ 	 * added. 
212+ 	 * If listener is null, no exception is thrown and no action is  performed. 
209213	 * 
210214	 * @param listener a native mouse motion listener object 
211215	 */ 
@@ -217,8 +221,8 @@ public static void removeNativeMouseMotionListener(NativeMouseMotionListener lis
217221
218222	/** 
219223	 * Adds the specified native mouse wheel listener to receive mouse wheel 
220- 	 * events from the native system. If listener is null, no exception is  
221- 	 * thrown and no action is performed. 
224+ 	 * events from the native system. 
225+ 	 * If listener is null, no exception is  thrown and no action is performed. 
222226	 * 
223227	 * @param listener a native mouse wheel listener object 
224228	 * @since 1.1 
@@ -233,8 +237,8 @@ public static void addNativeMouseWheelListener(NativeMouseWheelListener listener
233237	 * Removes the specified native mouse wheel listener so that it no longer 
234238	 * receives mouse wheel events from the native system. This method performs 
235239	 * no function if the listener specified by the argument was not previously 
236- 	 * added.  If listener is null, no exception is thrown and no action is  
237- 	 * performed. 
240+ 	 * added. 
241+ 	 * If listener is null, no exception is thrown and no action is  performed. 
238242	 * 
239243	 * @param listener a native mouse wheel listener object 
240244	 * @since 1.1 
@@ -346,25 +350,25 @@ public NativeHookException getException() {
346350		}
347351
348352		/** 
349- 		 * Native implementation to start the input hook.   This method blocks and should only be called by this 
350- 		 * specialized thread implementation.   This method will notifyAll() after passing any exception exception 
353+ 		 * Native implementation to start the input hook. This method blocks and should only be called by this 
354+ 		 * specialized thread implementation. This method will notifyAll() after passing any exception exception 
351355		 * throwing code. 
352356		 * 
353357		 * @throws NativeHookException problem registering the native hook with the underlying operating system. 
354358		 */ 
355359		protected  native  void  enable () throws  NativeHookException ;
356360
357361		/** 
358- 		 * Native implementation to stop the input hook.   There is no other way to stop the hook. 
362+ 		 * Native implementation to stop the input hook. There is no other way to stop the hook. 
359363		 * 
360364		 * @throws NativeHookException problem un-registering the native hook with the underlying operating system. 
361365		 */ 
362366		public  native  void  disable () throws  NativeHookException ;
363367
364368		/** 
365- 		 * Dispatches an event to the appropriate processor.   This method is 
369+ 		 * Dispatches an event to the appropriate processor. This method is 
366370		 * generally called by the native library but may be used to synthesize 
367- 		 * native events from Java without replaying them on the native system.   If 
371+ 		 * native events from Java without replaying them on the native system. If 
368372		 * you would like to send events to other applications, please use 
369373		 * {@link #postNativeEvent}, 
370374		 * <p> 
@@ -408,7 +412,7 @@ public static void registerNativeHook() throws NativeHookException {
408412					Thread .sleep (250 );
409413				}
410414				catch  (InterruptedException  e ) {
411- 					log .warning (e .getMessage ());
415+ 					logger .warning (e .getMessage ());
412416					break ;
413417				}
414418			}
@@ -480,36 +484,36 @@ public static boolean isNativeHookRegistered() {
480484	 * 
481485	 * For both <code>NATIVE_KEY_PRESSED</code> and 
482486	 * <code>NATIVE_KEY_RELEASED</code> events, the virtual keycode and modifier 
483- 	 * mask are used in the creation of the native event.   Please note that some 
487+ 	 * mask are used in the creation of the native event. Please note that some 
484488	 * platforms may generate <code>NATIVE_KEY_PRESSED</code> and 
485489	 * <code>NATIVE_KEY_RELEASED</code> events for each required modifier. 
486490	 * <code>NATIVE_KEY_TYPED</code> events will first translate the associated 
487491	 * keyChar to its respective virtual code and then produce a 
488492	 * <code>NATIVE_KEY_PRESSED</code> followed by a <code>NATIVE_KEY_RELEASED</code> 
489- 	 * event using that virtual code.   If the JNativeHook is unable to translate 
493+ 	 * event using that virtual code. If the JNativeHook is unable to translate 
490494	 * the keyChar to its respective virtual code, the event is ignored. 
491495	 * <p> 
492496	 * 
493497	 * <code>NativeMouseEvents</code> are processed in much the same way as the 
494- 	 * <code>NativeKeyEvents</code>.   Both <code>NATIVE_MOUSE_PRESSED</code> and 
498+ 	 * <code>NativeKeyEvents</code>. Both <code>NATIVE_MOUSE_PRESSED</code> and 
495499	 * <code>NATIVE_MOUSE_RELEASED</code> produce events corresponding to the 
496- 	 * event's button code.   Keyboard modifiers may be used in conjunction with 
500+ 	 * event's button code. Keyboard modifiers may be used in conjunction with 
497501	 * button press and release events, however, they might produce events for each 
498- 	 * modifier.   <code>NATIVE_MOUSE_CLICKED</code> events produce a 
502+ 	 * modifier. <code>NATIVE_MOUSE_CLICKED</code> events produce a 
499503	 * <code>NATIVE_MOUSE_PRESSED</code> event followed by a 
500504	 * <code>NATIVE_MOUSE_RELEASED</code> for the assigned event button. 
501505	 * <p> 
502506	 * 
503507	 * <code>NATIVE_MOUSE_DRAGGED</code> and <code>NATIVE_MOUSE_MOVED</code> events 
504- 	 * are handled identically.   In order to produce a <code>NATIVE_MOUSE_DRAGGED</code> 
508+ 	 * are handled identically. In order to produce a <code>NATIVE_MOUSE_DRAGGED</code> 
505509	 * event, you must specify a button modifier mask that contains at least one 
506- 	 * button modifier and assign it to the event.   Failure to do so will produce a 
510+ 	 * button modifier and assign it to the event. Failure to do so will produce a 
507511	 * <code>NATIVE_MOUSE_MOVED</code> event even if the event id was set to 
508512	 * <code>NATIVE_MOUSE_DRAGGED</code>. 
509513	 * <p> 
510514	 * 
511515	 * <code>NATIVE_MOUSE_WHEEL</code> events are identical to 
512- 	 * <code>NATIVE_MOUSE_PRESSED</code> events.   Wheel events will only produce 
516+ 	 * <code>NATIVE_MOUSE_PRESSED</code> events. Wheel events will only produce 
513517	 * pressed events and will never produce <code>NATIVE_MOUSE_RELEASED</code>, 
514518	 * <code>NATIVE_MOUSE_DRAGGED</code> or <code>NATIVE_MOUSE_MOVED</code> 
515519	 * 
@@ -666,9 +670,9 @@ private void processMouseWheelEvent(NativeMouseWheelEvent nativeEvent) {
666670	}
667671
668672	/** 
669- 	 * Set a different executor service for native event delivery.   By default, 
673+ 	 * Set a different executor service for native event delivery. By default, 
670674	 * JNativeHook utilizes a single thread executor to dispatch events from 
671- 	 * the native event queue.   You may choose to use an alternative approach 
675+ 	 * the native event queue. You may choose to use an alternative approach 
672676	 * for event delivery by implementing an <code>ExecutorService</code>. 
673677	 * <p> 
674678	 * <b>Note:</b> Using null as an <code>ExecutorService</code> will cause all 
0 commit comments