// receive events
System.out.println("couldn't open socket. must be the server");
ServerSocket server = new ServerSocket(6754);
Socket sock = server.accept();
EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
ObjectInputStream in = new ObjectInputStream(sock.getInputStream());
while(true ) {
String id = (String) in.readObject();
AWTEvent evt = (AWTEvent) in.readObject();
if(evt instanceof MouseEvent) {
MouseEvent me = (MouseEvent)evt;
MouseEvent me2 = new MouseEvent(
(Component)component_map.get(id),
me.getID(),
me.getWhen(),
me.getModifiers(),
me.getX(),
me.getY(),
me.getClickCount(),
me.isPopupTrigger(),
me.getButton()
);
eq.postEvent(me2);
}
}