redirecting output at cursor position in java -


how can text sent cursor position clicking button in java? working on project "on screen keyboard" developing using java. want redirect text click on button cursor position normal keyboard key press event do.

hello can try use robot class robot doc. used example automated test of ui. example small robot class:

import java.awt.awtexception; import java.awt.robot; import java.awt.event.keyevent;   public class smallrobot {       /**      * @param args      */     public static void main(string[] args) {          robot rob = null;         try {             rob = new robot();         }         catch (awtexception e) {             e.printstacktrace();         }         rob.delay(10000);         rob.keypress(keyevent.vk_h);         rob.keypress(keyevent.vk_e);         rob.keypress(keyevent.vk_l);         rob.keypress(keyevent.vk_l);         rob.keypress(keyevent.vk_o);     } } 

you can run small app, ant click on text field on screen (for example notepad window). write in field/notpad text "hello". emulates key press events on keyboard.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -