I am developing a Real time English-Sinhala Unicode transl开发者_运维知识库ator 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 ?
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.
精彩评论