Find all open windows via Java
If you can get a list of references to all the Java windows that are open and running, then there are Swing methods to get all the components that are in one of those windows.
But if you are asking: How to get a list of references to all the Java windows that are open? I dont' think there is any way. Too OS specific.
And even if you could get a reference to a window, the fields might be private and not allow access.
The Robot class is the only one I've seen that comes close to what you want to do. But its write-only. Ie you can position the cursor and enter text, but you can't see what you are doing.
Norm
Re: Enumerate child windows
Java programs typically run in their own JVM, so if your auto-fill application is run independently, it won't have direct access to your main program, but will need to use an indirect technique, e.g. RMI (Remote Method Invocation). You haven't explained the reasons behind your design (why is a separate program required to fill the form?) So it might be worth considering alternatives...
Dave
Re: Enumerate child windows
The java.awt.Window class has several method that may be useful:
static Window[] getWindows() - Returns an array of all Windows, both owned and ownerless
static Window[] getOwnerlessWindows() - Returns an array of all Windows created by this application that have no owner.
Window getOwner() - Returns the owner of this window.
Window[] getOwnedWindows() - Returns an array containing all the windows this window currently owns.
Re: Enumerate child windows
Er, remkop, that thread is nearly 6 years old - even if the poster didn't find an answer, it won't matter now :rolleyes:
Furious activity is no substitute for understanding...
H.H. Williams
Re: Enumerate child windows
dlorde, you're right of course.
It's just that I did a search for "enumerate Java windows", and this thread was the first relevant link, but I couldn't find what I was looking for. So after finding the answer in the javadocs I just added the info to save future searchers some trouble. I realise it looks a bit silly, sorry about that.
Re: Enumerate child windows
Remkop,
I am agree with you.. your small inputs can save lots of search..and hours..
Thanks for posting.