fork download
  1. import java.util.logging.Level;
  2. import java.util.logging.Logger;
  3.  
  4. import org.jnativehook.GlobalScreen;
  5. import org.jnativehook.NativeHookException;
  6.  
  7. import org.jnativehook.mouse.NativeMouseWheelEvent;
  8. import org.jnativehook.mouse.NativeMouseWheelListener;
  9.  
  10. import com.cycling74.max.Atom;
  11. import com.cycling74.max.MaxObject;
  12.  
  13. public class globalMousewheel extends MaxObject implements NativeMouseWheelListener{
  14.  
  15. public globalMousewheel(Atom[] args) {
  16. //declareAttribute("autostart", null, "autoStart");
  17. declareIO(1, 1);
  18. }
  19.  
  20. @Override
  21. public void nativeMouseWheelMoved(NativeMouseWheelEvent e) {
  22. outlet(0, e.getWheelRotation());
  23.  
  24. }
  25.  
  26. public void start(){
  27. // Get the logger for "org.jnativehook" and set the level to warning.
  28. // Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
  29. // logger.setLevel(Level.WARNING);
  30.  
  31. //no log message please
  32. final Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
  33. logger.setLevel(Level.OFF);
  34.  
  35. //start NativeHook
  36. try {
  37. GlobalScreen.registerNativeHook();
  38. }
  39. catch (NativeHookException ex) {
  40. post("There was a problem registering the native hook.");
  41. post(ex.getMessage());
  42. }
  43. //start the listener
  44. GlobalScreen.addNativeMouseWheelListener(this);
  45. }
  46.  
  47. public void stop(){
  48. //stop the listener
  49. GlobalScreen.removeNativeMouseWheelListener(this);
  50. //Stop the nativeHook
  51. try {
  52. GlobalScreen.unregisterNativeHook();
  53. }
  54. catch (NativeHookException ex) {
  55. post("There was a problem unregistering the native hook.");
  56. post(ex.getMessage());
  57. }
  58. }
  59.  
  60. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:13: error: class globalMousewheel is public, should be declared in a file named globalMousewheel.java
public class globalMousewheel extends MaxObject implements NativeMouseWheelListener{
       ^
Main.java:4: error: package org.jnativehook does not exist
import org.jnativehook.GlobalScreen;
                      ^
Main.java:5: error: package org.jnativehook does not exist
import org.jnativehook.NativeHookException;
                      ^
Main.java:7: error: package org.jnativehook.mouse does not exist
import org.jnativehook.mouse.NativeMouseWheelEvent;
                            ^
Main.java:8: error: package org.jnativehook.mouse does not exist
import org.jnativehook.mouse.NativeMouseWheelListener;
                            ^
Main.java:10: error: package com.cycling74.max does not exist
import com.cycling74.max.Atom;
                        ^
Main.java:11: error: package com.cycling74.max does not exist
import com.cycling74.max.MaxObject;
                        ^
Main.java:13: error: cannot find symbol
public class globalMousewheel extends MaxObject implements NativeMouseWheelListener{
                                      ^
  symbol: class MaxObject
Main.java:13: error: cannot find symbol
public class globalMousewheel extends MaxObject implements NativeMouseWheelListener{
                                                           ^
  symbol: class NativeMouseWheelListener
Main.java:15: error: cannot find symbol
public globalMousewheel(Atom[] args) {
                        ^
  symbol:   class Atom
  location: class globalMousewheel
Main.java:21: error: cannot find symbol
public void nativeMouseWheelMoved(NativeMouseWheelEvent e) {
                                  ^
  symbol:   class NativeMouseWheelEvent
  location: class globalMousewheel
Main.java:17: error: cannot find symbol
declareIO(1, 1);
^
  symbol:   method declareIO(int,int)
  location: class globalMousewheel
Main.java:20: error: method does not override or implement a method from a supertype
@Override
^
Main.java:32: error: cannot find symbol
final Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
                                       ^
  symbol:   class GlobalScreen
  location: class globalMousewheel
Main.java:37: error: cannot find symbol
GlobalScreen.registerNativeHook();
^
  symbol:   variable GlobalScreen
  location: class globalMousewheel
Main.java:39: error: cannot find symbol
catch (NativeHookException ex) {
       ^
  symbol:   class NativeHookException
  location: class globalMousewheel
Main.java:40: error: cannot find symbol
post("There was a problem registering the native hook.");
^
  symbol:   method post(String)
  location: class globalMousewheel
Main.java:44: error: cannot find symbol
GlobalScreen.addNativeMouseWheelListener(this);
^
  symbol:   variable GlobalScreen
  location: class globalMousewheel
Main.java:49: error: cannot find symbol
GlobalScreen.removeNativeMouseWheelListener(this);
^
  symbol:   variable GlobalScreen
  location: class globalMousewheel
Main.java:52: error: cannot find symbol
GlobalScreen.unregisterNativeHook();
^
  symbol:   variable GlobalScreen
  location: class globalMousewheel
Main.java:54: error: cannot find symbol
catch (NativeHookException ex) {
       ^
  symbol:   class NativeHookException
  location: class globalMousewheel
Main.java:55: error: cannot find symbol
post("There was a problem unregistering the native hook.");
^
  symbol:   method post(String)
  location: class globalMousewheel
22 errors
stdout
Standard output is empty