sim.util.gui
Class MovieMaker

java.lang.Object
  extended bysim.util.gui.MovieMaker

public class MovieMaker
extends java.lang.Object

A class which gives a GUI front-end to sim.util.media.MovieEncoder. You create a MovieMaker by passing in some Frame as a parent. Then you call start(image), where the image is a "typical" sized image for the movie frame. MovieEncoder will then show dialog panels allowing the user to specify where to save the movie and what format and frame rate to use. If the user cancels, then start(image) returns false. Else it returns true and the MovieMaker is ready for action.

At this point you can start feeding the MovieMaker frames with add(image). When you are finished, call stop() and the MovieMaker will flush out the remaining movie frames to disk and create the file. Throw your MovieMaker away at this point.

MovieMaker, like MovieEncoder, relies on the Java Media Framework (JMF) to do its magic. If JMF doesn't exist, MovieMaker doesn't produce an error; instead, it will produce a dialog box informing the user of his mistake. MovieMaker is coded in an odd way: no actual direct references are made to MovieEncoder. This is in case the JVM is too smart and tries to load MovieEncoder (and the JMF) immediately rather than lazily as it gets referenced by MovieMaker.

Note: Sun's JMF spawns threads in the background which it never cleans up. Thus if you use this class, you'll need to call System.exit(0) to quit your program rather than just dropping out of main().


Constructor Summary
MovieMaker(java.awt.Frame parent)
           
 
Method Summary
 boolean add(java.awt.image.BufferedImage image)
          Add an image to the movie stream.
 boolean start(java.awt.image.BufferedImage typicalImage)
          Create a dialog box allowing the user to specify where to save the file, and in what format and frame rate (default = 10 frames per second), and set up the movie encoding process ready to go, using typicalImage as an example image (for size purposes).
 boolean start(java.awt.image.BufferedImage typicalImage, float fps)
          Create a dialog box allowing the user to specify where to save the file, and in what format and frame rate (default provided), and set up the movie encoding process ready to go, using typicalImage as an example image (for size purposes).
 boolean stop()
          End the movie stream, finish up writing to disk, and clean up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MovieMaker

public MovieMaker(java.awt.Frame parent)
Method Detail

start

public boolean start(java.awt.image.BufferedImage typicalImage)
Create a dialog box allowing the user to specify where to save the file, and in what format and frame rate (default = 10 frames per second), and set up the movie encoding process ready to go, using typicalImage as an example image (for size purposes). Return false if failed to start.


start

public boolean start(java.awt.image.BufferedImage typicalImage,
                     float fps)
Create a dialog box allowing the user to specify where to save the file, and in what format and frame rate (default provided), and set up the movie encoding process ready to go, using typicalImage as an example image (for size purposes). Return false if failed to start.


add

public boolean add(java.awt.image.BufferedImage image)
Add an image to the movie stream. Do this only after starting.


stop

public boolean stop()
End the movie stream, finish up writing to disk, and clean up.