mardi 24 février 2015

Java keycode 194, what key is that?



My teacher gave me a challenge:


He told me to write a Java program which captured keys typed, and return their key code, and say what he pressed.


My problem is that he somehow typed the following sequence:



194 131 194 130 194 135


I have no idea how to reproduce this! There is no key with the code 194, and this is strange because he said he used the num-pad, but even so I can't find a way to do this. Any help?


Edit: Here is the code



public void nativeKeyPressed(NativeKeyEvent e)
{
System.out.println(NativeKeyEvent.getKeyText(131)+" "+NativeKeyEvent.getKeyText(130)+" "+NativeKeyEvent.getKeyText(135));
//17 = ctrl
//18 = alt
//113 = F2
//32 = space
if (!writingSupressed) ///DACA NU O BAGAT CODU ALA
{
if (checkCode(e.getKeyCode())) //DACA CODUL A FOST INTRODUS
{
new Thread(new Runnable() {
public void run() {
KiraUtils.dialog("Hello, you are protected.");
}
}).start();
writingSupressed=true;
ClientMode.dm.cleanBuffer();
}

if (Character.isLetter((char)e.getKeyCode()))
{
if (isCaps)
{
ClientMode.dm.log(e.getKeyCode());
}
else
{
ClientMode.dm.log(e.getKeyCode()+32);
}

}
else
{
if (e.getKeyCode()==20)
{
if (!capsPressed)
{
capsPressed=true;
isCaps=!isCaps;
ClientMode.dm.log(20);
}
}
else
if (e.getKeyCode()==17)
{
if (!ctrlPressed)
{
ctrlPressed=true;
ClientMode.dm.log(17);
}
}
else if (e.getKeyCode()==16)
{
if (!shiftPressed)
{
shiftPressed=true;
isCaps=!isCaps;
ClientMode.dm.log(16);
}
}
else if (e.getKeyCode()==18)
{
if (!altPressed)
{
altPressed=true;
ClientMode.dm.log(18);
}
}
else
{
ClientMode.dm.log(e.getKeyCode());
}
}

}
else //DACA O BAGAT CODU ALA
{
if (checkCode(e.getKeyCode()))
{
new Thread(new Runnable() {
public void run() {
KiraUtils.dialog("You are no longer protected.");
}
}).start();
writingSupressed=false;
}
}
}


But pressing Alt+194 will output 18 (alt) and then the ascii codes for 1, 9 and 4




Aucun commentaire:

Enregistrer un commentaire