Zoo5.java
import java.awt.*;
import java.awt.event.*;
import quicktime.QTSession;
import quicktime.QTException;
import quicktime.app.display.QTCanvas;
/**
* QTZoo Module 5 - Custom Movie Controllers
* This application requires QuickTime for Java 4.1
*
* @author Levi Brown
* @author Michael Hopkins
* @author Apple Computer, Inc.
* @version 5.0 12/15/99
*/
public class Zoo5 extends Frame
{
static public int WIDTH = 640;
static public int HEIGHT = 480;
/**
* Zoo constructor
* @param string title of window
*/
public Zoo5( String s )
{
super(s);
setResizable( false ); // we don't want the window to resize
setBounds( 0, 0, WIDTH, HEIGHT ); // make window 640x480
QTCanvas myQTCanvas = new QTCanvas( QTCanvas.kInitialSize, 0.5F, 0.5F );
add( myQTCanvas );
AnimalPane zebraPane = new AnimalPane();// load media
try
{
myQTCanvas.setClient( zebraPane.getCompositor(), true );
zebraPane.start();
}
catch ( QTException e )
{
e.printStackTrace();
}
addWindowListener( new WindowAdapter() // anonymous inner class for handling window events
{
public void windowClosing( WindowEvent we )
{
QTSession.close(); // shut down QT and clean up
dispose(); // destroy window
}
public void windowClosed( WindowEvent we )
{
System.exit( 0 ); // exit to shell
}
});
}
/**
* Main entry point for the application
*/
public static void main( String[] args )
{
try
{
QTSession.open(); // perform native QuickTime initialization
Zoo5 appWindow = new Zoo5( "QTZoo5" ); // create a new application window
appWindow.show(); // make the window visible
appWindow.toFront(); // bring it to the front
}
catch ( Exception e ) // handle any exceptions
{
QTSession.close();
e.printStackTrace();
}
}
}