问题
I am developing a Real time English-Sinhala Unicode translator in java.I did the translation part.But now I want to add the Final output Unicode characters to the currently active window (like a web browser).There's a way to add characters via java Robot class with Robot.keyPress(//keyInput) method.But is there any way to do this with java Unicode characters like u0200 hex value.If it can't be done with this way what solutions I have to resolve this.Please anyone help me ?
回答1:
Yes, you can simulate key presses using Robot
, as suggested here. No, Robot
can't see what's printed on the user's key caps. You're probably going to have to develop a virtual keyboard. When available, Unicode glyphs make usable button labels, as shown here.
Addendum: Note that a KeyEvent represents a keystroke, while Unicode encodes graphemes represented by glyphs. The mapping depends on the keyboard layout, e.g. Sinhala.
来源:https://stackoverflow.com/questions/7279773/can-we-insert-unicode-characters-using-robot-class-in-java