tags:

views:

132

answers:

2

hi... i m doing a project on "remote screen capturing and controlling"....in java it is desktop application... thre is client-server architecture....here server can capture the clients and make wath on client but, that is not known to client that someone is watching him/her....

and after captureing the client the server can also controlling the client from captured data.....and it it done at client side...automatically...as controlled by server..... so i want your help ...please give me the suggestion....

+2  A: 

Check out the "java.awt.Robot" class:

http://java.sun.com/javase/6/docs/api/java/awt/Robot.html

These methods should help you:

BufferedImage createScreenCapture(Rectangle screenRect);
void keyPress(int keycode) 
void keyRelease(int keycode) 
void mouseMove(int x, int y) 
void mousePress(int buttons) 
void mouseRelease(int buttons)
cliff.meyers
+1  A: 

You have in this article the basics of screen capture using Robot (as suggested by brd6644's answer)

We can capture whole desktop, and save it to a PNG file, as follows.

public void captureScreen(String fileName) throws Exception {
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    BufferedImage image = new Robot().createScreenCapture(new Rectangle(screenSize));
    ImageIO.write(image, "png", new File(fileName));
}

Alternatively, we might capture our JFrame, including its window decoration, as follows.

public void captureFrame(JFrame frame, String fileName) throws Exception {
    BufferedImage image = new Robot().createScreenCapture(frame.getBounds());
    ImageIO.write(image, "png", new File(fileName));
}

The old (2003) jxta-remote-desktop project can also give you some pointers

VonC