How to capture the contents of the screen and feed it to a JMF player or Processor for purposes such as saving screen shots to disk or transmitting live using RTP.
Java 2 v.1.3 introduced a new class, java.awt.Robot, that provides screen capture facilities. Since this is similar to capturing video from a VCR or camera, it is best encapsulated in a JMF DataSource object. This example shows how to use Robot to create a screen capture DataSource.
The DataSource is a PushDataSource that pushes captured screen shots at regular intervals to the connected Player or Processor. It creates a new protocol "screen" with the following URL syntax:
where x, y specify a screen location and width,height specify the size. fps specifies the number of frames to push per second. This can be any fraction greater than zero, although realistic values would be between 0.1 and 30.0.
For example, to capture screen activity in the center of a 1024x768 screen, use
Note: This program requires JDK 1.3 or higher to compile and to run.