0

All I can find on google is code to add listeners and events to wait for buttons to be pressed.

I am trying to make it so that the code actually presses the buttons.

I know that KeyModifier.SHIFT and Key.HOME exist but I don't know how to use them or if they are the right keywords.

Any help would be greatly appreciated.

Ona_17
  • 35
  • 1
  • 8
  • 1
    This surely has been asked many times before, like [here](http://stackoverflow.com/questions/3585000/inject-a-keystroke-in-java), [here](http://stackoverflow.com/questions/1248510/convert-string-to-keyevents) or [here](http://stackoverflow.com/questions/11442471/press-a-key-with-java) – Alexander Jul 30 '12 at 19:04

2 Answers2

1

Look at the Robot class: http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html But be careful because i have found myself in loops or just stuck with my mouse and keyboard stuck being used by the robot.

Zoop
  • 646
  • 5
  • 7
0

Trying looking at the "Robot" class:

paulsm4
  • 114,292
  • 17
  • 138
  • 190