I am writing code to enter strings using the Robot class. Everything is basically fine (well, I have to use the large switch statement to get the character codes), except that some keys don't have key codes, because they are actually a Shift+ key combination of another key. For uppercase letters, it is easy to check using Character.isUpperCase(c), but for all characters, such as !@#$%^&*()_+various punctuation, they are not considered "upper case", although this requires a shift for pressing to generate a keystroke, I tried searching the site, but just found forum post without satisfactory answers. Is there a way to determine if a character needs to be changed, and if so, which character is the “unbiased” version?
EDIT: Here is the code I have.
public void GenerateKeyTyped(char c) {
if (Character.isUpperCase(c)) {
r.keyPress(KeyEvent.VK_SHIFT);
}
r.keyPress(GetKeyCode(c));
r.keyRelease(GetKeyCode(c));
if (Character.isUpperCase(c)) {
r.keyRelease(KeyEvent.VK_SHIFT);
}
}