I'm looking for a way to make an application (app1), separate from another java application (app2), that can acces the GUI of app2 and also listen to all events that are passed to app2.

I would like to be able to get hold of the frame of app2 so I can traverse its child components. I would like to listen to all possible events from any external sources like mouse, keyboard, etc, that app2 reveices, which app1 also should recieve.

Any ideas on how to do this?


If these applications are run separately, there is no way to do this in Java, as it keeps things nice and clean (one of the reasons it is allowed on the web, otherwise people would be hijacking each others' applications all the time and it wouldn't be safe to have Java on your computer).

If, however, you wanted to build something like a custom VNC app you could try something like java.awt.Robot, combined with a full screen JFrame painting the desktop of another machine.

If you REALLY wanted to, you could write to a text file in some fashion, being sure to not read and write at the same time with the two apps. I'm not entirely sure how one might do this, but, it's an idea, nonetheless.

Probably a bad idea too.

This article has been dead for over six months. Start a new discussion instead.