QTSession.open() twice?
Imported from the Apple Support Forums via the Wayback Machine 🔗
I found that I have to call QTSession.open() twice for not be thrown this.
I found that one call of QTSession.open() woks in OS X.
Can anybody help me?
Exception in thread "AWT-EventQueue-0" quicktime.QTNullPointerException: QuickTime MUST be initialized:quicktime.std.image.GraphicsImporter
at quicktime.QTObject._ID(QTObject.java:77)
at quicktime.std.image.GraphicsImporter.setBoundsRect(GraphicsImporter.java:411)
at quicktime.app.view.AWTCanvasHelper.doSetBounds(AWTCanvasHelper.java:574)
at quicktime.app.view.QTJavaAWTCanvas.paint(QTJavaAWTCanvas.java:652)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import quicktime.QTException;
import quicktime.QTSession;
import quicktime.app.view.QTComponent;
import quicktime.app.view.QTFactory;
import quicktime.io.QTFile;
import quicktime.std.image.GraphicsImporter;
public class Zoo1 extends Frame {
public static int WIDTH = 640;
public static int HEIGHT = 480;
public Zoo1(String s) throws IOException, QTException {
super(s);
setResizable(false);
setBounds(0, 0, WIDTH, HEIGHT);
/*
QTCanvas myQTCanvas = new QTCanvas(QTCanvas.kInitialSize, 0.5f, 0.ff);
add(myQTCanvas);
*/
QTFile imageFile =
new QTFile(QTFactory.findAbsolutePath("data/zebra/ZebraBackground.jpg"));
GraphicsImporter importer = new GraphicsImporter(imageFile);
QTComponent component = QTFactory.makeQTComponent(importer);
add(component.asComponent());
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
QTSession.close();
dispose();
}
public void windowClosed(WindowEvent we) {
System.exit(0);
}
});
}
public static void main(String[] args) throws IOException, QTException {
QTSession.open();
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
QTSession.close();
}
});
// Why should I call this again?
/*
QTSession.open();
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
QTSession.close();
}
});
*/
Zoo1 appWindow = new Zoo1("QTZoo 1");
//appWindow.show();
appWindow.setVisible(true);
//appWindow.toFront();
QTSession.close();
}
}
0 replies
Sign in or join Beachball Help to reply.