home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-06-23 | 2.7 KB | 115 lines |
- import java.awt.Color;
- import java.awt.GridBagLayout;
- import java.awt.GridBagConstraints;
-
- import quicktime.QTSession;
- import quicktime.QTException;
- import quicktime.app.display.FullScreenWindow;
- import quicktime.std.movies.FullScreen;
-
- import com.apple.mrj.MRJApplicationUtils;
- import com.apple.mrj.MRJQuitHandler;
-
-
- /**
- * QTZoo Module 9 - Using Full Screen Mode
- * This application requires QuickTime for Java
- *
- * @author Levi Brown
- * @author Michael Hopkins
- * @author Apple Computer, Inc.
- * @version 9.0 4/10/2000
- *
- */
-
- public class Zoo implements MRJQuitHandler, Runnable //!! added Runnable !!
- {
- /**
- * Zoo constructor
- */
- public Zoo()
- {
- MRJApplicationUtils.registerQuitHandler(this); // register handler for command-Q
-
- //-- Create new progress bar object --
- //-- Insert "1 Zoo- create progress" source clipping here --
- try
- {
- window = new FullScreenWindow(new FullScreen()); // create a new fullscreen window
- window.setBackground (Color.black); // color window black
-
- window.setLayout(new GridBagLayout());
- gbc = new GridBagConstraints();
- gbc.gridx = 1;
- gbc.gridy = 1;
- gbc.gridwidth = 1;
- gbc.anchor = GridBagConstraints.CENTER;
- gbc.fill = GridBagConstraints.NONE;
-
- //-- Add progress object to window --
- //-- Insert "3 Zoo- add progress" source clipping here --
-
- window.show();
- //-- Create and start new thread --
- //-- Insert "4 Zoo- create thread" source clipping here --
-
- //!! We don't need the following because we are now a runnable !!
- /* run(); */
- }
- catch (QTException exc)
- {
- exc.printStackTrace();
- }
- }
-
- /**
- * Main body of class. Creates main window, and displays it
- */
- public void run()
- {
- mainFrame = new MainFrame(window, progress);
-
- //-- Remove progress bar --
- //-- Insert "5 Zoo- remove progress" source clipping here --
- mainFrame.setVisible(true);
- ((GridBagLayout)window.getLayout()).setConstraints(mainFrame, gbc);
- window.add(mainFrame);
- mainFrame.invalidate();
- window.validate();
- }
-
- /**
- * Handles quitting the application.
- * This routine gets called by the MRJToolkit when the
- * application is about to quit.
- */
- public void handleQuit()
- {
- mainFrame.handleQuit();
- }
-
- /**
- * Main entry point of our program
- */
- static public void main(String[] args)
- {
- try
- {
- QTSession.open(); // Initialize QuickTime
- new Zoo( );
- }
- catch (Exception e)
- {
- e.printStackTrace();
- QTSession.close(); // Shut down QuickTime and dispose of native context
- }
- }
-
- protected MainFrame mainFrame;
- protected FullScreenWindow window;
- protected GridBagConstraints gbc;
-
- //-- Declare progress object data member --
- //-- Insert "2 Zoo- declare progress" source clipping here --
- }
-