Vote count:
0
I am trying to use global hot keys for my java application.I searched a lot and finally decided to use JIntellitype.I learnt that it uses JNI to interact with OS.I have downloaded JIntelliType API from http://ift.tt/1octS4Z
I have included the jar far in my project and it shows in (Project_name) -> (Referenced libraries) -> jintellitype_1.3.9.jar .Have i imported it correctly?
I have written the following sample program to test it
import com.melloware.jintellitype.HotkeyListener;
import com.melloware.jintellitype.JIntellitype;
public class Example1 {
public static void main() throws Exception
{
System.out.println("Line 1");
//JIntellitype.getInstance().registerHotKey(1, JIntellitype.MOD_WIN, (int)'A');
//JIntellitype.getInstance().registerHotKey(2, JIntellitype.MOD_ALT + JIntellitype.MOD_SHIFT, (int)'B');
hkey h=new hkey();
h.init_hotkey();
}
}
class hkey
{
void init_hotkey()
{
System.out.println("line 2");
JIntellitype.getInstance();
JIntellitype.getInstance().registerHotKey(1, JIntellitype.MOD_WIN, (int)'A');
JIntellitype.getInstance().addHotKeyListener(new HotkeyListener() {
@Override
public void onHotKey(int arg0) {
// TODO Auto-generated method stub
if (arg0 == 1)
System.out.println("WINDOWS+A hotkey pressed");
}
});
}
}
It shows me no errors or warnings.But the lines "line 1"and "line 2 " are not printed.My console shows me this after running.
JIntellitype version "1.3.9"
Running on java version "1.7.0_55" (build 1.7.0_55-b13) from Oracle Corporation
Operating environment "Windows 7" version 6.1 on x86
For more information on JIntellitype please visit http://ift.tt/1BAWS0m
Is it a problem with the code or am i not importing properly? Is there any example program for JIntellitype.There is one here http://ift.tt/1octS4Z but it does not have .java files in it.It has compiled .class files in it.
Using JIntellitype in eclipse
Aucun commentaire:
Enregistrer un commentaire