I'm writing a virtual keyboard for my application and I'm using Java robot in order to simulate the keypress event of each keyboard button. Everything is right except that I can't find the keycode for European special chars, specifically the italian ones. Scanning every possible code I've found that:
à is KeyEvent.VK_DEAD_ABOVERING
ì is KeyEvent.VK_DEAD_CIRCUMFLEX
ò is KeyEvent.VK_DEAD_CEDILLA
ù is KeyEvent.VK_DEAD_GRAVE
but I'm missing the keycode for "è", it appears like if no code can produce this char.
I've also already tried to get the missing code using tools that prints out each key pressed on the phisical keyboard, but I get "unkown" for each one of the above chars (including the "è").
Here is a piece of code to test it
package robottest;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
public class RobotTest {
private static Robot robot;
public static void main(String[] args) {
// TODO code application logic here
try {
robot = new Robot();
int keyCode = KeyEvent.VK_DEAD_CARON;
robot.keyPress(keyCode);
robot.keyRelease(keyCode);
} catch (AWTException ex) {
System.out.println("Exception"+ex);
}
}
}
It is minimal, you can compile it and run with
java -jar RobotTest.jar
Here is what i get modifying my source to act as a kind "code scanner" ...
package robottest;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import javafx.scene.input.KeyCode;
public class RobotTest {
private static Robot robot;
public static void main(String[] args) {
// TODO code application logic here
try {
robot = new Robot();
/* int keyCode = KeyEvent.VK_DEAD_BREVE;
robot.keyPress(keyCode);
robot.keyRelease(keyCode);
*/
for (int keyCode = KeyEvent.VK_DEAD_GRAVE; keyCode <KeyEvent.VK_DEAD_GRAVE+20; keyCode++) {
System.out.print("Code "+keyCode+" ");
robot.keyPress(keyCode);
robot.keyRelease(keyCode);
System.out.println("");
}
} catch (AWTException ex) {
System.out.println("Exception"+ex);
}
}
}
The output is:
Code 128 ù
Code 129 ,
Code 130 ì
Code 131 3
Code 132 -
Code 133 ù
Code 134
Code 135 .
Code 136 à
Code 137 2
Code 138
Code 139 ò
Code 140 0
Code 141
Code 142
Code 143
Code 144
Code 145
Code 146
Code 147