|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
krut.KRUT_GUI.SnapShot
public class SnapShot
This class is used to show a snapshot. Originally the snapshot was only used to show a single screenshot; however it was later expanded to include the preview window. The new methods (the preview related ones) use the old methods for initialization. This update was done more like a hack than as a restructuring, and the readability of the code suffered. This should be worked on. The original code for showing just a screenshot is found in the snapshot-related methods in RunKRUT and ScreenGrabber, and the new calls for updating the preview window are made from the run method in the ScreenGrabber class.
Nested Class Summary | |
---|---|
class |
SnapShot.ShowPic
This class shows the image. |
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
javax.swing.JFrame |
previewFrame
The JFrame used to show the animation of the film as it records. |
int |
sleepMillis
This is the amount of milliseconds to sleep between each update of the window. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
SnapShot()
|
Method Summary | |
---|---|
void |
createAndShowGUI(javax.swing.JFrame frame,
java.awt.image.BufferedImage image)
Show a new image in a new SnapShot window. |
void |
initPreviewWindow(int width,
int height)
Initializes and shows the preview window, displaying a new BufferedImage. |
java.awt.Image |
loadPic(java.lang.String fileName,
java.awt.Component comp)
Load a picture from file into an Image |
void |
run()
As long as the isRunning parameter is true, the present method sleeps an amount of time determined by the sleepMillis parameter. |
void |
setFps(int fps)
Changes the update frequency of the preview window. |
void |
stopPreviewWindow()
Closes the preview window and free system resources. |
void |
updatePreviewImage(java.awt.image.BufferedImage nextImage)
Update the image in the preview window. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public javax.swing.JFrame previewFrame
public int sleepMillis
Constructor Detail |
---|
public SnapShot()
Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public java.awt.Image loadPic(java.lang.String fileName, java.awt.Component comp) throws java.lang.OutOfMemoryError
fileName
- The name of the file containing the picturecomp
- A component (like the frame where the image
should be drawn) to use for the MediaTracker.
java.lang.OutOfMemoryError
public void initPreviewWindow(int width, int height)
width
- The width of the preview window.height
- The height of the preview window.public void setFps(int fps)
fps
- The update frequency given as updates per second.public void stopPreviewWindow()
public void updatePreviewImage(java.awt.image.BufferedImage nextImage)
nextImage
- The BufferedImage that should be shown in
the preview window at the next update.public void createAndShowGUI(javax.swing.JFrame frame, java.awt.image.BufferedImage image) throws java.lang.OutOfMemoryError
frame
- The frame to show the image in.image
- The image.
java.lang.OutOfMemoryError
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |