0

I am trying to make a program that if you would press a button, it would send a message to the computer as if a button on the keyboard was pressed, kinda like the on screen keyboard the pc has, or something like that. How can i tell the program to send a "message" as such? do i need to use scanner?

Thanks

Baruch
  • 1,618
  • 5
  • 23
  • 42

1 Answers1

1

You can use Java Robot class for this purpose. http://docs.oracle.com/javase/1.5.0/docs/api/java/awt/Robot.html for example :

Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_A);
robot.keyPress(KeyEvent.VK_C); 
Kanishka Dilshan
  • 724
  • 2
  • 10
  • 19