public void GetMotion(){ try { Robot robot=new Robot(); ServerSocket Server=new ServerSocket(2222); System.out.println("Server Started.."); float x = 0.0f; float y = 0.0f; int x1 = 0,y1 = 0; while (true) { Point p=MouseInfo.getPointerInfo().getLocation(); Socket Serversocket=Server.accept(); System.out.println("Client Connected...."); BufferedReader br=new BufferedReader(new InputStreamReader(Serversocket.getInputStream())); do { String str=br.readLine(); if(str.startsWith("x:")) { x =Float.valueOf(str.substring(2)); x1=(int) x+p.x; System.out.println("X:"+str.substring(2)); } if(str.startsWith("y:")){ System.out.println("Y:"+str.substring(2)); y =Float.valueOf(str.substring(2)); y1=(int) y+p.y; } robot.mouseMove(x1,y1); } while (true); } } catch (AWTException ex) { System.out.println(ex); } catch (IOException ex) { Logger.getLogger(MouseMove.class.getName()).log(Level.SEVERE, null, ex); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)