javax.robotics.image
Class ScreenImage

java.lang.Object
  extended by javax.robotics.image.ScreenImage

public class ScreenImage
extends java.lang.Object

Utility class to capture buffered images from swing and AWT components.


Constructor Summary
ScreenImage()
           
 
Method Summary
 java.awt.image.BufferedImage createDesktopImage()
          Convenience method to create a BufferedImage of the desktop
 java.awt.image.BufferedImage createImage(java.awt.Component component)
           
 java.awt.image.BufferedImage createImage(javax.swing.JComponent component)
           
 java.awt.image.BufferedImage createImage(javax.swing.JComponent component, java.awt.Rectangle region)
           
 java.awt.image.BufferedImage createImage(java.awt.Rectangle region)
          Create a BufferedImage from a rectangular region on the screen.
 void writeImage(java.awt.image.BufferedImage image, java.lang.String fileName)
          Write a BufferedImage to a File.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScreenImage

public ScreenImage()
Method Detail

createImage

public java.awt.image.BufferedImage createImage(javax.swing.JComponent component)
                                         throws java.io.IOException
Throws:
java.io.IOException

createImage

public java.awt.image.BufferedImage createImage(javax.swing.JComponent component,
                                                java.awt.Rectangle region)
                                         throws java.io.IOException
Throws:
java.io.IOException

createImage

public java.awt.image.BufferedImage createImage(java.awt.Component component)
                                         throws java.awt.AWTException,
                                                java.io.IOException
Throws:
java.awt.AWTException
java.io.IOException

createImage

public java.awt.image.BufferedImage createImage(java.awt.Rectangle region)
                                         throws java.awt.AWTException,
                                                java.io.IOException
Create a BufferedImage from a rectangular region on the screen.

Parameters:
region - region on the screen to create image from
Returns:
image the image for the given region
Throws:
java.awt.AWTException - see Robot class constructors
java.io.IOException - if an error occurs during writing

createDesktopImage

public java.awt.image.BufferedImage createDesktopImage()
                                                throws java.awt.AWTException,
                                                       java.io.IOException
Convenience method to create a BufferedImage of the desktop

Returns:
image the image for the given region
Throws:
java.awt.AWTException - see Robot class constructors
java.io.IOException - if an error occurs during writing

writeImage

public void writeImage(java.awt.image.BufferedImage image,
                       java.lang.String fileName)
                throws java.io.IOException
Write a BufferedImage to a File.

Parameters:
image - image to be written
fileName - name of file to be created
Throws:
java.io.IOException - if an error occurs during writing