当前位置: 首页>>代码示例>>Java>>正文


Java GlobalScreen.addNativeMouseMotionListener方法代码示例

本文整理汇总了Java中org.jnativehook.GlobalScreen.addNativeMouseMotionListener方法的典型用法代码示例。如果您正苦于以下问题:Java GlobalScreen.addNativeMouseMotionListener方法的具体用法?Java GlobalScreen.addNativeMouseMotionListener怎么用?Java GlobalScreen.addNativeMouseMotionListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jnativehook.GlobalScreen的用法示例。


在下文中一共展示了GlobalScreen.addNativeMouseMotionListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException
{
	disableLogging();
	try
	{
		GlobalScreen.registerNativeHook();
	}
	catch (NativeHookException ex)
	{
		System.err.println("There was a problem registering the native hook.");
		System.err.println(ex.getMessage());

		System.exit(1);
	}

	GlobalMouseListener globalMouseListener = new GlobalMouseListener();
	GlobalScreen.addNativeMouseListener(globalMouseListener);
	GlobalScreen.addNativeMouseMotionListener(globalMouseListener);
	GlobalScreen.addNativeMouseWheelListener(globalMouseListener);
	GlobalScreen.addNativeKeyListener(new GlobalKeyListener());
}
 
开发者ID:tomzx,项目名称:gkm-java,代码行数:22,代码来源:GlobalListener.java

示例2: initNativeMouseMotionListener

import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
/**
 * Use jnativehook to detect mouse drag events and show popover
 */
private void initNativeMouseMotionListener() {
	try {
		GlobalScreen.registerNativeHook();
	} catch (NativeHookException e1) {
		e1.printStackTrace();
	}
	GlobalScreen.addNativeMouseMotionListener(this);
	GlobalScreen.addNativeMouseListener(this);
	GlobalScreen.addNativeKeyListener(this);
}
 
开发者ID:michaelnetter,项目名称:dracoon-dropzone,代码行数:14,代码来源:DropzonePopOver.java

示例3: startLogging

import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
public void startLogging() {

		try {
			GlobalScreen.registerNativeHook();
		} catch (NativeHookException e) {
			BioLogger.LOGGER.severe("There was a problem registering the native hook.");
			if (System.getProperty("os.name").toLowerCase().contains("mac")) {
				BioLogger.LOGGER.severe("Make sure that Assistive Devices is enabled.");
				BioLogger.LOGGER.severe(
						"Go to System Preferences->Security & Privacy->Accessibility");
			}
			e.printStackTrace();
			return;
		}

		if (mClassMap.containsKey(BioKeystrokeEvent.class)) {
			GlobalScreen.addNativeKeyListener(mListener);
		}

		if (mClassMap.containsKey(BioClickEvent.class)) {
			GlobalScreen.addNativeMouseListener(mListener);
		}

		if (mClassMap.containsKey(BioMotionEvent.class)) {
			GlobalScreen.addNativeMouseMotionListener(mListener);
		}

		if (mClassMap.containsKey(BioWheelEvent.class)) {
			GlobalScreen.addNativeMouseWheelListener(mListener);
		}
	}
 
开发者ID:vmonaco,项目名称:biologger,代码行数:32,代码来源:BioLogger.java

示例4: register

import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
private void register() {
	GlobalScreen.addNativeMouseListener(this);
	GlobalScreen.addNativeMouseMotionListener(this);
	GlobalScreen.addNativeMouseWheelListener(this);
}
 
开发者ID:GamesRythmAnalysis,项目名称:RNGames,代码行数:6,代码来源:MouseListener.java

示例5: startListening

import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
@Override
public boolean startListening() {
	GlobalScreen.addNativeMouseListener(this);
	GlobalScreen.addNativeMouseMotionListener(this);
	return true;
}
 
开发者ID:repeats,项目名称:Repeat,代码行数:7,代码来源:GlobalMouseListener.java

示例6: startListening

import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
public void startListening() throws NativeHookException{
  GlobalScreen.registerNativeHook();
  GlobalScreen.addNativeKeyListener(keyboard);
  GlobalScreen.addNativeMouseListener(keyboard);
  GlobalScreen.addNativeMouseMotionListener(keyboard);
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:7,代码来源:Keyboard.java

示例7: itemStateChanged

import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
/**
 * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
 */
public void itemStateChanged(ItemEvent e) {
	ItemSelectable item = e.getItemSelectable();

	if (item == menuItemEnable) {
		try {
			// Keyboard checkbox was changed, adjust listeners accordingly.
			if (e.getStateChange() == ItemEvent.SELECTED) {
				// Initialize native hook.  This is done on window open because the
				// listener requires the txtEventInfo object to be constructed.
				GlobalScreen.registerNativeHook();
			}
			else {
				GlobalScreen.unregisterNativeHook();
			}
		}
		catch (NativeHookException ex) {
			txtEventInfo.append("Error: " + ex.getMessage() + "\n");
		}

		// Set the enable menu item to the state of the hook.
		menuItemEnable.setState(GlobalScreen.isNativeHookRegistered());

		// Set enable/disable the sub-menus based on the enable menu item's state.
		menuSubListeners.setEnabled(menuItemEnable.getState());
	}
	else if (item == menuItemKeyboardEvents) {
		// Keyboard checkbox was changed, adjust listeners accordingly
		if (e.getStateChange() == ItemEvent.SELECTED) {
			GlobalScreen.addNativeKeyListener(this);
		}
		else {
			GlobalScreen.removeNativeKeyListener(this);
		}
	}
	else if (item == menuItemButtonEvents) {
		// Button checkbox was changed, adjust listeners accordingly
		if (e.getStateChange() == ItemEvent.SELECTED) {
			GlobalScreen.addNativeMouseListener(this);
		}
		else {
			GlobalScreen.removeNativeMouseListener(this);
		}
	}
	else if (item == menuItemMotionEvents) {
		// Motion checkbox was changed, adjust listeners accordingly
		if (e.getStateChange() == ItemEvent.SELECTED) {
			GlobalScreen.addNativeMouseMotionListener(this);
		}
		else {
			GlobalScreen.removeNativeMouseMotionListener(this);
		}
	}
	else if (item == menuItemWheelEvents) {
		// Motion checkbox was changed, adjust listeners accordingly
		if (e.getStateChange() == ItemEvent.SELECTED) {
			GlobalScreen.addNativeMouseWheelListener(this);
		}
		else {
			GlobalScreen.removeNativeMouseWheelListener(this);
		}
	}
}
 
开发者ID:kwhat,项目名称:jnativehook,代码行数:66,代码来源:NativeHookDemo.java


注:本文中的org.jnativehook.GlobalScreen.addNativeMouseMotionListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。