Let's suppose I've got some program open, something like a notepad. I want to make a JButton write in it, so when I click the JButton some character appears in the notepad. Is there any way to do it?
Asked
Active
Viewed 62 times
0
-
Yes and no, it's complicated. Once focus is removed from the app in question, it becomes no longer possible to write to it (through Java anyway). So you would either need to have a delay between when you clicked the button and when the "writing" started, so you could re-focus the app or make the window and button unfocusable – MadProgrammer Jun 23 '15 at 01:38
-
Thanks. And if I want a Jbutton work like a key what would I use? If you know, could you tell me where could i find that? – LeviathanTheEsper Jun 23 '15 at 01:55
-
Refer [this](http://www.javaprogrammingforums.com/java-se-api-tutorials/59-how-sendkeys-application-java-using-robot-class.html) and [this](http://stackoverflow.com/questions/14595483/using-java-to-send-key-combinations) and read about java robot framework – Madhan Jun 23 '15 at 19:24
-
Ohh, that's it. Thanks. – LeviathanTheEsper Jun 25 '15 at 16:33