Question

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

Was it helpful?

Solution

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); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top