1

I need a way to do what is described in the first answer to this question: Type a String using java.awt.Robot

Only I would like to avoid using the clipboard. Is there a generic way to do it without?

(Other answers to the question address printing some hard-coded keys, but they don't help me print "Hello, world!")

Community
  • 1
  • 1
Irina Rapoport
  • 1,404
  • 1
  • 20
  • 37

1 Answers1

1

You can use javax.swing.KeyStroke to transform the characters in your string into keycodes. For each key code, call Robot.keyPress(...), Robot.keyRelease(...) as you are doing in your previous question

ControlAltDel
  • 33,923
  • 10
  • 53
  • 80