Hi i need to press non-english keys like "ü","ö" in java but i didnt managed to do this using robot class. So how can i press non-english characters?

combine the VK_O, etc, with VK_DEAD_DIAERESIS.

thanks for the reply but i get this error

Exception in thread "main" java.lang.IllegalArgumentException: Invalid key code
at sun.awt.windows.WRobotPeer.keyPress(Native Method)
at java.awt.Robot.keyPress(Robot.java:224)
at RobotExp.main(RobotExp.java:13)

can you help me with this too. I cant see any reason for this exception, here is the 13th line

robot.keyPress(KeyEvent.VK_DEAD_DIAERESIS);

That was just a guess (although DIAERESIS is the umlaut). Upon further investigation, KeyEvent is able to retreive the character (getKeyChar), but it cannot retrieve the code (getKeyCode) which is the int that needs to be used in Robot, and everything I've searched seems to point to the unfortunate circumstance that those keys simply are not provided a KeyCode and so cannot be used by Robot. The only thing I can say is to submit a "Request For Enhancement (RFE)" (or vote for any you can find on this topic). Through Sun it was handled in the bug database, not sure how it is handled through Oracle, though.

Thanks a lot for your help masijade. Well i found a workaround, using windows alt codes like Alt+0252 for "ü". That works for me right now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.