Java Code Examples for org.jnativehook.GlobalScreen#addNativeMouseListener()

The following examples show how to use org.jnativehook.GlobalScreen#addNativeMouseListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Recorder.java    From SikuliX1 with MIT License 6 votes vote down vote up
/**
 * starts recording
 */
public void start() {
  if (!running) {
    RunTime.loadLibrary(RunTime.libOpenCV);
    running = true;

    eventsFlow.clear();
    currentImage = null;
    currentImageFilePath = null;

    try {
      screenshotDir = Files.createTempDirectory("sikulix").toFile();
      screenshotDir.deleteOnExit();
    } catch (IOException e) {
      throw new SikuliXception("Recorder: createTempDirectory: not possible");
    }

    screenshot(0);

    Recorder.registerNativeHook();
    GlobalScreen.addNativeKeyListener(this);
    GlobalScreen.addNativeMouseListener(this);
    GlobalScreen.addNativeMouseMotionListener(this);
    GlobalScreen.addNativeMouseWheelListener(this);
  }
}
 
Example 2
Source File: HotKeysInterceptor.java    From MercuryTrade with MIT License 5 votes vote down vote up
public HotKeysInterceptor() {
    Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
    logger.setLevel(Level.OFF);

    logger.setUseParentHandlers(false);
    try {
        GlobalScreen.registerNativeHook();
    } catch (NativeHookException e) {
        e.printStackTrace();
    }

    GlobalScreen.addNativeKeyListener(new MercuryNativeKeyListener());
    GlobalScreen.addNativeMouseListener(new MercuryNativeMouseListener());
}
 
Example 3
Source File: HotKeysInterceptor.java    From MercuryTrade with MIT License 5 votes vote down vote up
public static void main(String[] args) {
//        new HotKeysInterceptor();
        Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
        logger.setLevel(Level.OFF);

        logger.setUseParentHandlers(false);
        try {
            GlobalScreen.registerNativeHook();
        } catch (NativeHookException e) {
            e.printStackTrace();
        }
        GlobalScreen.addNativeMouseListener(new MercuryNativeMouseListener());
    }
 
Example 4
Source File: GlobalJNativeHookMouseListener.java    From Repeat with Apache License 2.0 4 votes vote down vote up
@Override
public boolean startListening() {
	GlobalScreen.addNativeMouseListener(this);
	GlobalScreen.addNativeMouseMotionListener(this);
	return true;
}