Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NativeGraphics and ClassCastException



Dear list,

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:

getContext(java.awt.Canvas canv)
getContext(java.awt.Component canv)
getContext(java.lang.Object canv)

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)


which is counter intuitive to say the least.

Any ideas?

Cheers,
Steve

_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-java mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-java/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.