Zoo3.java
import java.awt.*;
import java.awt.event.*;
import quicktime.QTSession;
import quicktime.QTException;
import quicktime.app.display.QTCanvas;
/**
* QTZoo Module 3 - Using QuickTime to draw text
* This application requires QuickTime for Java 4.1
*
* @author Levi Brown
* @author Michael Hopkins
* @author Apple Computer, Inc.
* @version 4.0 1/15/2000
*
* Revision History
* ---------------------------------------------------------------------------------
* 11/15/99 MSH moved media loading into AnimalPane( ), set client to compositor
* 12/02/99 MSH removed superfluous imports, improved formatting and added comments
* 01/15/00 MSH updated code for QTJ 4.1
*/
public class Zoo3 extends Frame
{
static public int WIDTH = 640;
static public int HEIGHT = 480;
/**
* Zoo constructor
* @param string title of window
*/
public Zoo3( 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 );
}
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
Zoo3 appWindow = new Zoo3( "QTZoo3" ); // 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();
}
}
}