switch focus to another window
hello, i'm trying to write an app to control another app in Windows, there is a keyPress method in Robot class, but i don't know how to specify which process to send the key, is there any methods to send focus to a specific window and bring it to top on desktop, therefore i can send a key to it properly?
Re: switch focus to another window
Within the same java application, you can just call the toFront() method on a Window instance. However if you wish to try and control other applications, you are probably stuck using Runtime.exec(). This would also be highly platform dependent, and you need to know the command line tools and parameters well to be able to call the appropriate commands (if they exist) to get the behavior you want.
Originally Posted by tuansoibk