Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using SwingEventMonitor to monitor other applications?

How do I use SwingEventMonitor to monitor mouse events in applications running in other JVMs?

The demo code I have can monitor mouse clicks in applications running within its own JVM, but applications started seperately or via jnlp are ignored.

How do I make sure Java loads my SwingEventMonitor app with every application, regardless of how its started (desktop or jnlp)

like image 213
DFriend Avatar asked Nov 12 '11 01:11

DFriend


1 Answers

Run your monitor and create a sever = ServerSocket(MONITOR_PORT). Then listen for incoming connections:

while (true) {
    Socket socket = server.accept();
    connectionCount++;
    // start a new monitor thread for this connection
}

Note: SwingEventMonitor is not included anymore in JDK1.7, you may wish to push your own EventQueue. See What happened to SwingEventMonitor?

like image 99
sina72 Avatar answered Oct 14 '22 05:10

sina72