In tandem with my other post, I have been experimenting with some of
Rolf's suggestions from January 2005. However, I've come upon a very
thorny problem. I have the following code:
canvas = new Canvas() {
public void paint( Graphics g) {
g.drawImage( image, 0, 0, this);
}
public Dimension getPreferredSize() {
return new Dimension( image.getWidth(),
image.getHeight());
}
};
where canvas is:
Canvas canvas;
from:
import java.awt.Canvas;
I have a method that initializes GDGraphics from that canvas once it
has been placed in a parent container and pack()ed:
public void initGraphics() throws NativeGraphicsException,
QTUnknownOSException {
NativeGraphics ng = NativeGraphics.getContext( canvas);
gWorld = ng.getGWorld();
}
According to the javadoc, NativeGraphics has three
NativeGraphics.getContext() methods:
However, when I run this code, I get a ClassCastException
Exception in thread "main" java.lang.ClassCastException
at quicktime.qd.NativeGraphics.getContext(NativeGraphics.java:47)
at quicktime.qd.NativeGraphics.getContext(NativeGraphics.java:31)
at com.trantech.clearview.recorder.QTRecorder.initGraphics
(QTRecorder.java:88)
at com.trantech.clearview.recorder.QTService.main(QTService.java:
48)