How to capture screen using java.awt.robot in rmi?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, May 4, 2006 06:47 AM

i m a new learner in java rmi and i would like to create a project. In this i want to capture the screen of remote pc with using java.awt.robot object to capture the screen. then i would like to use Toolkit object to get my screen.So,any one can tell me or give me a guide how to capture a remote pc'screen and return it to client ?and am i correct to implement the interface at the example as below? 1) interface public interface ComputeEngin extends Remote { Object execute(Robot robot)throws RemoteException; } 2) implements interface public class ComputeEnginImpl extends UnicastRemoteObject implements C   More>>


i m a new learner in java rmi and i would like to create a project. In this i want to capture the screen of remote pc with using java.awt.robot object to capture the screen.


then i would like to use Toolkit object to get my screen.So,any one can tell me or give me a guide how to capture a remote pc'screen and return it to client ?and am i correct to implement the interface at the example as below?


1) interface

			
public interface ComputeEngin extends Remote
{
Object execute(Robot robot)throws RemoteException;
}



2) implements interface

			
public class ComputeEnginImpl extends UnicastRemoteObject implements ComputeEngin
{
public ComputeEnginImpl() throws RemoteException
{
super();
}

public static void main(String[] args)throws Exception
{
.......
}

// get remote pc's screen
public Object execute(Robot robot)
{
Toolkit defaultTookit = Toolkit.getDefaultToolkit();
Rectangle shotArea = new Rectangle (defaultTookit.getScreenSize());
ByteArrayOutputStream bout = new ByteArrayOutputStream();
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bout);
encoder.encode(robot.createScreenCapture(shotArea));
return bout.toByteArray();
}

public String toString()
{
return "ScreenShot";
}
}



any hits are welcome .thank you very much.

   <<Less
About | Sitemap | Contact