public class ScreenCaptureUtils
extends java.lang.Object
Constructor and Description |
---|
ScreenCaptureUtils() |
Modifier and Type | Method and Description |
---|---|
static java.awt.image.BufferedImage |
createDesktopImage()
Create a BufferedImage of the desktop
|
static java.awt.image.BufferedImage |
createImage(java.awt.Component component)
Create a BufferedImage for AWT components.
|
static java.awt.image.BufferedImage |
createImage(javax.swing.JComponent component)
Create a BufferedImage for Swing components.
|
protected static java.awt.image.BufferedImage |
createImage(javax.swing.JComponent component,
java.awt.Rectangle region)
Create a BufferedImage for Swing components.
|
protected static java.awt.image.BufferedImage |
createImage(java.awt.Rectangle region)
Create a BufferedImage from a rectangular region on the screen.
|
protected static void |
layoutComponent(java.awt.Component component) |
static java.awt.image.BufferedImage |
readImageFromByteArray(byte[] image) |
static java.awt.image.BufferedImage |
resizeImage(java.awt.image.BufferedImage img,
int width,
int height) |
static boolean |
saveJFrameAsImage(javax.swing.JFrame frame,
java.lang.String filepath)
export screenshot of jframe as image file
|
static byte[] |
writeImageToByteArray(java.awt.image.BufferedImage image,
java.lang.String format) |
static void |
writeImageToFile(java.awt.image.BufferedImage image,
java.lang.String fileName)
Write a BufferedImage to a File.
|
public static boolean saveJFrameAsImage(javax.swing.JFrame frame, java.lang.String filepath)
frame
- filepath
- public static java.awt.image.BufferedImage createImage(javax.swing.JComponent component)
component
- Swing component to create image fromprotected static java.awt.image.BufferedImage createImage(javax.swing.JComponent component, java.awt.Rectangle region)
component
- Swing component to create image fromregion
- The region of the component to be captured to an imagepublic static java.awt.image.BufferedImage createDesktopImage() throws java.awt.AWTException, java.io.IOException
fileName
- name of file to be created or nulljava.awt.AWTException
- see Robot class constructorsjava.io.IOException
- if an error occurs during writingpublic static java.awt.image.BufferedImage createImage(java.awt.Component component) throws java.awt.AWTException
component
- AWT component to create image fromjava.awt.AWTException
- see Robot class constructorsprotected static java.awt.image.BufferedImage createImage(java.awt.Rectangle region) throws java.awt.AWTException
region
- region on the screen to create image fromjava.awt.AWTException
- see Robot class constructorspublic static void writeImageToFile(java.awt.image.BufferedImage image, java.lang.String fileName) throws java.io.IOException
image
- image to be writtenfileName
- name of file to be createdjava.io.IOException
- if an error occurs during writingpublic static byte[] writeImageToByteArray(java.awt.image.BufferedImage image, java.lang.String format)
image
- format
- java.io.IOException
public static java.awt.image.BufferedImage readImageFromByteArray(byte[] image)
image
- protected static void layoutComponent(java.awt.Component component)
component
- public static java.awt.image.BufferedImage resizeImage(java.awt.image.BufferedImage img, int width, int height)
img
- width
- height
- Copyright © 2010-2014 Pacific Biosciences. All Rights Reserved.