1

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 ?

Thusitha
  • 3,393
  • 3
  • 21
  • 33

1 Answers1

3

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.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • it looks like Robot can't handle arbitrary unicode. It can only handle the set of keys specified in [KeyEvent](http://download.oracle.com/javase/6/docs/api/constant-values.html#java.awt.event.KeyEvent.CHAR_UNDEFINED). I'm trying to find a solution to this as well ... I'll answer back here if I find a way. – drfloob Oct 03 '11 at 06:27
  • I appreciate your taking time to comment, but I don't understand the down-vote. – trashgod Oct 03 '11 at 11:20
  • (shrugs) I cannot say why someone else down-voted the answer, but I can tell you that I'm impressed that you can cram 7 (count them, *7*) links into 6 sentences. Woo-hoo! – Andrew Thompson Oct 03 '11 at 12:06
  • @Andrew Thompson: Thanks for looking at this; your élan is always refreshing. It's a perennial problem, as the mapping relies on the host's implementation. Mine recognizes myriad layouts and a few input method variants, but Sri Lanka is not among them. – trashgod Oct 05 '11 at 19:55