VideoRecorderGifVideoRecorder, ImageVideoRecorderpublic abstract class ScratchVideoRecorder extends java.lang.Object implements VideoRecorder
| Modifier and Type | Field | Description |
|---|---|---|
protected boolean |
canRecord |
|
protected static javax.swing.JFileChooser |
chooser |
|
protected static javax.swing.text.JTextComponent |
chooserField |
|
protected java.lang.String |
chosenExtension |
|
protected java.awt.Dimension |
dim |
|
protected static java.lang.String |
ext |
|
protected int |
frameCount |
|
protected double |
frameDuration |
|
protected java.awt.Image |
frameImage |
|
protected boolean |
hasContent |
|
protected static boolean |
ignoreChooser |
|
protected boolean |
isSaved |
|
protected boolean |
saveChanges |
|
protected java.io.File |
saveFile |
|
protected java.io.File |
scratchFile |
|
protected java.lang.String |
scratchName |
|
protected int |
scratchNumber |
|
protected java.lang.String |
suggestedFileName |
|
protected static java.lang.String |
tempDirectory |
|
protected java.lang.String |
tempFileBasePath |
|
protected static java.lang.String |
tempFilePrefix |
|
protected java.util.ArrayList<java.io.File> |
tempFiles |
|
protected java.lang.String |
tempFileType |
|
protected VideoType |
videoType |
| Constructor | Description |
|---|---|
ScratchVideoRecorder(VideoType vidType) |
Constructs a ScratchVideoRecorder for the specified video type.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addFrame(java.awt.Image image) |
Adds a video frame with the specified image.
|
protected abstract boolean |
append(java.awt.Image image) |
Appends a frame to the current video.
|
protected void |
createScratch() |
Creates the scratch file.
|
void |
createVideo() |
Creates a new video (scratch file) and sets fileName to null.
|
void |
createVideo(java.lang.String fileName) |
Creates a new video and sets the destination file name.
|
protected void |
deleteTempFiles() |
Deletes the temporary files.
|
protected void |
finalize() |
Called by the garbage collector when this recorder is no longer in use.
|
java.lang.String |
getFileName() |
Gets the file name of the destination video.
|
protected java.io.File |
getFileToBeSaved(java.io.File file) |
Return the file that will be saved if the specified file is selected.
|
protected java.lang.String |
getScratchExtension() |
Returns the extension to use for the scratch file.
|
Video |
getVideo() |
Gets the current scratch video.
|
void |
reset() |
Discards the current video and resets the recorder to a ready state.
|
protected abstract void |
saveScratch() |
Saves the current video to the scratch file.
|
java.lang.String |
saveVideo() |
Saves the scratch video to the current file or chooser file.
|
java.lang.String |
saveVideo(java.lang.String fileName) |
Saves the current scratch video to the specified file name.
|
java.lang.String |
saveVideoAs() |
Saves the scratch video to a file picked from a chooser.
|
protected java.io.File |
selectFile() |
Shows a save dialog used to set the output movie file.
|
void |
setFileName(java.lang.String path) |
Sets the file name.
|
void |
setFrameDuration(double millis) |
Sets the time duration per frame.
|
void |
setSize(java.awt.Dimension dimension) |
Sets the size of the video.
|
protected abstract boolean |
startRecording() |
Starts the video recording process using current dimension dim.
|
void |
suggestFileName(java.lang.String name) |
Suggests a file name.
|
protected static javax.swing.JFileChooser chooser
protected static javax.swing.text.JTextComponent chooserField
protected static java.lang.String ext
protected static boolean ignoreChooser
protected static java.lang.String tempDirectory
protected static java.lang.String tempFilePrefix
protected VideoType videoType
protected java.awt.Dimension dim
protected java.awt.Image frameImage
protected double frameDuration
protected int frameCount
protected java.lang.String scratchName
protected int scratchNumber
protected java.io.File scratchFile
protected boolean canRecord
protected boolean hasContent
protected boolean isSaved
protected java.io.File saveFile
protected boolean saveChanges
protected java.lang.String tempFileBasePath
protected java.lang.String tempFileType
protected java.util.ArrayList<java.io.File> tempFiles
protected java.lang.String suggestedFileName
protected java.lang.String chosenExtension
public ScratchVideoRecorder(VideoType vidType)
vidType - the video typepublic void createVideo()
throws java.io.IOException
createVideo in interface VideoRecorderjava.io.IOExceptionpublic void createVideo(java.lang.String fileName)
throws java.io.IOException
createVideo in interface VideoRecorderfileName - name of the file to which the video will be writtenjava.io.IOExceptionpublic void setSize(java.awt.Dimension dimension)
setSize in interface VideoRecorderdimension - the dimensions of the new videopublic void setFrameDuration(double millis)
setFrameDuration in interface VideoRecordermillis - the duration per frame in millisecondspublic void addFrame(java.awt.Image image)
throws java.io.IOException
addFrame in interface VideoRecorderimage - the image to be drawn on the video frame.java.io.IOExceptionpublic Video getVideo() throws java.io.IOException
getVideo in interface VideoRecorderjava.io.IOExceptionpublic java.lang.String saveVideo()
throws java.io.IOException
saveVideo in interface VideoRecorderjava.io.IOExceptionpublic java.lang.String saveVideo(java.lang.String fileName)
throws java.io.IOException
saveVideo in interface VideoRecorderfileName - the file namejava.io.IOExceptionpublic java.lang.String saveVideoAs()
throws java.io.IOException
saveVideoAs in interface VideoRecorderjava.io.IOExceptionpublic java.lang.String getFileName()
getFileName in interface VideoRecorderpublic void setFileName(java.lang.String path)
setFileName in interface VideoRecorderpath - the file namepublic void suggestFileName(java.lang.String name)
name - the file namepublic void reset()
reset in interface VideoRecorderprotected void createScratch()
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String getScratchExtension()
protected java.io.File selectFile()
protected java.io.File getFileToBeSaved(java.io.File file)
file - the file selected with the chooserprotected void finalize()
finalize in class java.lang.Objectprotected void deleteTempFiles()
protected abstract void saveScratch()
throws java.io.IOException
java.io.IOExceptionprotected abstract boolean startRecording()
protected abstract boolean append(java.awt.Image image)
image - the image to append