How do you get the VK code from a char that is a letter? It seems like you should be able to do something like javax.swing.KeyStroke.getKeyStroke(\'c\').getKeyCode()<
The answer of Adam Paynter (answered to the question Convert String to KeyEvents) should also work here. The simple but working idea is to have a big switch like the following:
public void type(char character) {
switch (character) {
case 'a': doType(VK_A); break;
case 'b': doType(VK_B); break;
case 'c': doType(VK_C); break;
case 'd': doType(VK_D); break;
case 'e': doType(VK_E); break;
// ...
case 'A': doType(VK_SHIFT, VK_A); break;
case 'B': doType(VK_SHIFT, VK_B); break;
case 'C': doType(VK_SHIFT, VK_C); break;
// ...
}
}
See the original answer for the whole listing (including surrounding utility class).