|
MATES 3.0-rc2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mates.util.Screenshot
A class for taking and saving screenshots of arbitrary objects.
Constructor Summary | |
Screenshot()
|
Method Summary | |
static java.lang.reflect.Method |
getPaintMethod(java.lang.Class c)
Determines if a given class implements the paint(java.awt.Graphics) method. |
static java.io.File |
getScreenshotSaveFile(java.awt.Component parent)
Prompts the user for a file to which to save a screenshot. |
static boolean |
saveScreenshot(java.lang.Object screenshot_provider,
int width,
int height,
java.io.File file)
Saves a screenshot of a given object that implements the paint(java.awt.Graphics) method. |
static boolean |
saveScreenshot(java.lang.Object screenshot_provider,
int width,
int height,
java.io.File file,
java.awt.Component parent)
Saves a screenshot of a given object that implements the paint(java.awt.Graphics) method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Screenshot()
Method Detail |
public static java.io.File getScreenshotSaveFile(java.awt.Component parent)
parent
- the parent component of the dialog; can be
null
.
null
is returned if the user cancelled the save.public static java.lang.reflect.Method getPaintMethod(java.lang.Class c)
paint(java.awt.Graphics)
method.
paint
method of a class. If the class
does not implement paint
, null
is
returned.public static boolean saveScreenshot(java.lang.Object screenshot_provider, int width, int height, java.io.File file) throws java.lang.IllegalArgumentException, java.lang.ClassNotFoundException, java.io.IOException
paint(java.awt.Graphics)
method.
screenshot_provider
- an object that implements the
paint(java.awt.Graphics)
method. This method will
be called to draw the screenshot.width
- the width of the screenshotheight
- the height of the screenshotfile
- the file to which to save the screenshot. The
filetype is determined by the file's extension. Currently,
only PNG and EPS are supported. EPS requires that the
EpsGraphics2D package is currently in Java's classpath. This
package can be freely downloaded from http://www.jibble.org/epsgraphics/.
true
on success. false
will
be returned if file
is not of a supported image
type.
java.lang.IllegalArgumentException
- if
screenshot_provider
does not have the
paint(java.awt.Graphics)
method implemented.
java.lang.ClassNotFoundException
- when writing to an EPS file and
org.jibble.epsgraphics.EpsGraphics2D
cannot be found.
java.io.IOException
- on error writing to file
.public static boolean saveScreenshot(java.lang.Object screenshot_provider, int width, int height, java.io.File file, java.awt.Component parent) throws java.lang.IllegalArgumentException
paint(java.awt.Graphics)
method.
screenshot_provider
- an object that implements the
paint(java.awt.Graphics)
method. This method will
be called to draw the screenshot.width
- the width of the screenshotheight
- the height of the screenshotfile
- the file to which to save the screenshot. The
filetype is determined by the file's extension. Currently,
only PNG and EPS are supported. EPS requires that the
EpsGraphics2D package is currently in Java's classpath. This
package can be freely downloaded from http://www.jibble.org/epsgraphics/.parent
- the parent component, to which to draw dialogs;
can be null
.
true
on success. false
will
be returned if file
is not of a supported image
type.
java.lang.IllegalArgumentException
- if
screenshot_provider
does not have the
paint(java.awt.Graphics)
method implemented.
|
MATES 3.0-rc2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |