[4574] in java-interest
Re: java-interest-digest V1 #36
daemon@ATHENA.MIT.EDU (John G. Bedworth)
Sun Jan 7 16:45:01 1996
Date: Sat, 6 Jan 1996 15:19:11 -0500
From: "John G. Bedworth" <john@natural.com>
To: michael@w3media.com
Cc: java-interest@java.sun.com
--part_AD14436E0055B9BD00000002
Content-Transfer-Encoding: Quoted-Printable
Content-Type: Text/Enriched; charset=ISO-8859-1
Content-Disposition: Inline
<fixed>> Everytime I try to compile this thread (via the Roaster =
compiler - not=20
> the Roaster), I get this error message:=20
> =20
> Error: Incompatible type. Explicit cast needed to convert=20
> ThreadContr to java/awt/image/ImageObserver=20
> ThreadController.java line 40=20
> =20
> I don't get it, since "ThreadContr" is an applet, hence providing=20
> the ImageObserver needed.=20
> =20
> For all the Roaster folks: If I use the javac compiler instead of=20
> the Roaster, it compiles okay, but dumps my system if I try to run it=20
> via the Applet Runner.=20
> =20
> Obviously I can't *cast* an applet into an ImageObserver (or can I?),=20
> what should I do?=20
I just experienced the same problem with an applet I was messing =
around with. I found that if I explicitly cast the object to =
an ImageObserver, it worked properly. Note that the Roaster? =
Compiler currently requires you to explicitly import the =
ImageObserver class.
Add the following line:
<smaller><larger>import<smaller><larger> java.awt.image.ImageObserver;
And make the following change:
public void run()
{
while(true)
{
--> g.drawImage(b.m[i],10,20,(ImageObserver)b);=20
i++ ;
if ( i=3D=3D 17)
i=3D0;
}
}
Hope this helps!
--part_AD14436E0055B9BD00000002
Content-Type: Text/Plain; charset=US-ASCII
Content-Disposition: Inline
John G. Bedworth \_ \_ \_ john@natural.com
Project Leader \_\_\_ \_ http://www.natural.com/
Emerging Technology \_ \__ \_ tel (617) 876-7680 x1204
Natural Intelligence, Inc. \_ \_ \_ fax (617) 492-7425
--part_AD14436E0055B9BD00000002--
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com