Re: [Jython-dev] Coercion or cast trouble with Jython and Swing...
by Oti other posts by this author
May 21 2003 11:23AM messages near this date
[Jython-dev] Coercion or cast trouble with Jython and Swing...
|
[Jython-dev] java.lang.VerifyError while trying to compile simple Python source
[bug reported]
[ remy moueza ]
> I'm having troubles with type coercion / casting with
> java.awt.Graphics objects:
> I want to use the drawPolygon() method but at runtime
> JPanel.getGraphics()
> returns a sun.awt.windows.WGraphics and the Jython interpreter try to
> cast it into a sun.java2d.SunGraphics2D. I never had such problems
> with Java.
AFAIK Jython does not cast to anything, it just uses the most specific
type available. But maybe you can show an example :-)
> class JDisplay ( JPanel, MouseListener, MouseMotionListener ):
> ...
>
> def display_poly ( self, poly, screen ):
> ...
>
>
> Here is the error message :
> sun.awt.windows.WGraphics # -> print gc
> Traceback (innermost last):
> File "C:\lecteurD\monDev\3Dmoteur\python\JAffichage.py", line 0, in
> main
> File "C:\lecteurD\monDev\3Dmoteur\python\JAffichage.py", line 0, in
> display
> File "C:\lecteurD\monDev\3Dmoteur\python\JAffichage.py", line 0, in
> display_facette
> TypeError: drawPolygon(): 1st arg can't be coerced to
> sun.java2d.SunGraphics2D
The Traceback is from method display_facette, while you provide the
code of method display_polygon. Please have a look at method
display_facette, and post it if you can't find the cause.
Best wishes !
Oti.
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
_______________________________________________
Jython-dev mailing list
Jython-dev@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-dev
Thread:
Oti
|