本文整理汇总了Java中org.jnativehook.GlobalScreen.unregisterNativeHook方法的典型用法代码示例。如果您正苦于以下问题:Java GlobalScreen.unregisterNativeHook方法的具体用法?Java GlobalScreen.unregisterNativeHook怎么用?Java GlobalScreen.unregisterNativeHook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jnativehook.GlobalScreen
的用法示例。
在下文中一共展示了GlobalScreen.unregisterNativeHook方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIpFromUser
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
private void getIpFromUser() {
GlobalScreen.unregisterNativeHook();
Scanner scanner = new Scanner(System.in);
String ip;
do {
System.out.println();
System.out.println("PLEASE TYPE IN YOUR OPPONENTS IP ADDRESS: ");
ip = scanner.next();
}
while(!ip.matches(IP_PATTERN));
try {
InetAddress ipAddress = InetAddress.getByName(ip);
System.out.println(ipAddress.toString());
controller.startMultiplayerMode(ipAddress);
this.gameState = GameState.Multiplayer;
} catch (UnknownHostException e) {
System.out.println("could not find host " + e);
controller.stopGame();
} finally {
scanner.close();
registerNativeHook();
}
}
示例2: PmTrans
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
private PmTrans(GlobalKeyListener gkl) {
// Initialize the interface
d = new Display();
shell = new Shell(d);
menuManager = new MenuManager(shell, this);
barManager = new BarManager(shell, this);
// Global keys
this.gKL = gkl;
initState();
initGui();
startAutoSave();
shell.open();
while (!shell.isDisposed())
if (!d.readAndDispatch())
d.sleep();
if (player != null) {
player.close();
player = null;
}
GlobalScreen.unregisterNativeHook();
saveState();
try {
Config.getInstance().save();
} catch (IOException e) {
// ignore
}
}
示例3: shutdown
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
@Override
public void shutdown() throws Exception
{
try
{
GlobalScreen.unregisterNativeHook();
}
catch (NativeHookException e)
{
throw new RuntimeException(e);
}
}
示例4: nativeKeyPressed
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
@Override
public void nativeKeyPressed(NativeKeyEvent e) {
System.out.println("Key Pressed: " + NativeKeyEvent.getKeyText(e.getKeyCode()));
if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
try {
GlobalScreen.unregisterNativeHook();
} catch (NativeHookException ex) {
ex.printStackTrace();
}
}
}
示例5: stop
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
@Override
public void stop() {
try {
GlobalScreen.unregisterNativeHook();
} catch (NativeHookException ex) {
System.err.println("There was a problem while unregistering the native hook.");
System.err.println(ex.getMessage());
}
System.out.println("Unregistered successfully");
File file = new File("screenshot.png");
file.delete();
System.runFinalization();
System.exit(0);
}
示例6: exit
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
/**
* Shuts down the program
*/
protected static final void exit(){
try {
GlobalScreen.unregisterNativeHook();
} catch (NativeHookException e1) {
e1.printStackTrace();
}
System.exit(0);
}
示例7: nativeKeyPressed
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
public void nativeKeyPressed(NativeKeyEvent e) {
if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
try {
GlobalScreen.unregisterNativeHook();
System.exit(1);
} catch (NativeHookException e1) {
}
}
}
示例8: disableHooks
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
/**
* Call this static method when you don't need to listen to events anymore.
* It unregisters native hook and stops catching mouse events at all.
*/
static void disableHooks() {
try {
GlobalScreen.unregisterNativeHook();
} catch (NativeHookException | UnsatisfiedLinkError e) {
e.printStackTrace();
}
}
示例9: shutdownVirtualizer
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
public void shutdownVirtualizer() {
try {
GlobalScreen.unregisterNativeHook();
} catch (NativeHookException e1) {
e1.printStackTrace();
}
System.runFinalization();
}
示例10: run
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
@Override
public void run() {
try {
GlobalScreen.unregisterNativeHook();
speeker.stop();
log.info("TypeTalk shutdown complete");
} catch (NativeHookException ex) {
log.warn("Unable to unregister native hook");
}
}
示例11: run
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
@Override
public void run() {
try {
GlobalScreen.unregisterNativeHook();
speeker.stop();
log.info("SpeechLess shutdown complete");
} catch (NativeHookException ex) {
log.warn("Unable to unregister native hook");
}
}
示例12: nativeKeyPressed
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
@Override
public void nativeKeyPressed(NativeKeyEvent e) {
System.out.println("Key Pressed: " + NativeKeyEvent.getKeyText(e.getKeyCode()));
if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
try {
GlobalScreen.unregisterNativeHook();
} catch (NativeHookException ex) {
Logger.getLogger(GlobalKeyListenerExample.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
示例13: cleanup
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
public void cleanup()
{
try
{
GlobalScreen.removeNativeKeyListener(this);
GlobalScreen.unregisterNativeHook();
}
catch (NativeHookException ex)
{
logger.log(Level.SEVERE, "There was a problem unregistering the native hook.", ex);
}
}
示例14: stopListeningToHotkeys
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
/** Makes {@link HotkeyManager} stop listening to Hotkeys. */
public static void stopListeningToHotkeys() throws NativeHookException {
if (isListening) {
GlobalScreen.unregisterNativeHook();
GlobalScreen.removeNativeKeyListener(nkListener);
isListening = false;
}
}
示例15: onShutdown
import org.jnativehook.GlobalScreen; //导入方法依赖的package包/类
private static void onShutdown() {
Console.debug("Finalizing Registers...");
JUnique.releaseLock(Ref.APP_ID);
try {
GlobalScreen.unregisterNativeHook();
} catch (NativeHookException e) {
Console.exception(e);
}
}