I am writing some code to type strings using the Robot class. Everything is mostly good (well, I have to use a big switch statement to get character keycodes), except some keys don't have keycodes, because they are actually a combination of SHIFT + some other key. For upper case letters, it is easy to check, using Character.isUpperCase(c), but for all the symbols such as !@#$%^&()+ and various punctuation are not considered "upper case" although they do require shift to be pressed in order to generate thier keystroke. I tried googling for it, but just found a forum post with no satisfactory answers. Is there any way to determine whether a character needs shift to be pressed, and if so, what character is the "un-shifted" version?
EDIT: Here is the code I have so far.
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);
}
}