FileDocCategorySizeDatePackage
PictFromMovie.javaAPI DocExample3054Wed Nov 10 12:38:08 GMT 2004com.oreilly.qtjnotebook.ch05

PictFromMovie

public class PictFromMovie extends Object

Fields Summary
Movie
movie
Constructors Summary
public PictFromMovie()

        try {
            QTSessionCheck.check();
            QTFile file =
                QTFile.standardGetFilePreview (QTFile.kStandardQTFileTypes);
            OpenMovieFile omFile = OpenMovieFile.asRead (file);
            movie = Movie.fromFile (omFile);
            MovieController controller = new MovieController (movie);
            QTComponent qtc = QTFactory.makeQTComponent (controller);
            Component c = qtc.asComponent();
            Frame frame = new Frame ("Pict From Movie");
            frame.setLayout (new BorderLayout());
            frame.add (c, BorderLayout.CENTER);
            Button pictButton = new Button ("Make movie.pict");
            pictButton.addActionListener (new ActionListener() {
                    public void actionPerformed (ActionEvent e) {
                        dumpToPict();
                    }
                });
            frame.add (pictButton, BorderLayout.SOUTH);
            frame.pack();
            frame.setVisible(true);
        } catch (QTException qte) {
            qte.printStackTrace();
        }
    
Methods Summary
public voiddumpToPict()

        try {
            float oldRate = movie.getRate();
            movie.stop();
            Pict pict = movie.getPict(movie.getTime());
            String absPictPath = (new File ("movie.pict")).getAbsolutePath();
            pict.writeToFile (new File (absPictPath));
            movie.setRate (oldRate);
        } catch (Exception e) {
            e.printStackTrace();
        }
    
public static voidmain(java.lang.String[] args)

        new PictFromMovie();