Package org.opensourcephysics.tools
Class SnapshotTool
java.lang.Object
org.opensourcephysics.tools.SnapshotTool
- All Implemented Interfaces:
Tool
This provides a simple way to capture screen images.
- Version:
- 1.0
- Author:
- Francisco Esquembre (http://fem.um.es), Wolfgang Christian
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Copies an image of a component to the clipboardvoid
Copies the specified image to the system clipboard.protected static void
Returns the image on the clipboard, if any.static String
static SnapshotTool
getTool()
Gets the shared SnapshotTool.static boolean
isImageFormatSupported
(String format) void
printImage
(Component component) Prints an image of a componentboolean
Saves the image produced by a componentboolean
saveImage
(String filename, Component component, OutputStream output) Saves the image produced by a component to an output streamboolean
saveImage
(String filename, Component component, OutputStream output, double scale) Saves the (possibly scaled) image produced by a component to an output streamvoid
Sends a job to this tool and specifies a tool to reply to.static void
-
Method Details
-
setLocale
-
getString
-
getTool
Gets the shared SnapshotTool.- Returns:
- the shared SnapshotTool
-
createChooser
protected static void createChooser() -
send
Sends a job to this tool and specifies a tool to reply to. -
saveImage
Saves the image produced by a component- Parameters:
filename
- the name of a filecomponent
- the component to get the image from- Returns:
- true if the file was correctly saved
-
saveImage
Saves the image produced by a component to an output stream- Parameters:
filename
- the name of a file (the extension indicates the format). If null, teh user will be prompted for a namecomponent
- the component to get the image fromoutput
- An optional output stream to save to. If null the image is saved to a file- Returns:
- true if the image was correctly saved
-
saveImage
Saves the (possibly scaled) image produced by a component to an output stream- Parameters:
filename
- the name of a file (the extension indicates the format). If null, the user will be prompted for a namecomponent
- the component to get the image fromoutput
- An optional output stream to save to. If null the image is saved to a filescale
- A scale factor that resizes the image. A value of 1 uses the actual size.- Returns:
- true if the image was correctly saved
-
isImageFormatSupported
-
copyImage
Copies the specified image to the system clipboard.- Parameters:
image
- the image to copy
-
getClipboardImage
Returns the image on the clipboard, if any.- Returns:
- the image, or null if none found
-
copyImage
Copies an image of a component to the clipboard- Parameters:
component
- the component to copy
-
printImage
Prints an image of a component- Parameters:
component
- the component to print
-