Make sure you are using the getImage() from the Toolkit class and not the Applet
class. The Applet class only supports getImage() for a URL. I couple things to
try:
i = getToolkit().getImage( "houses.gif" );
-- or --
i = getImage( new URL( "file:///..../houses.gif" ));
Andy
Yuet Sim Lee wrote:
> Hi,
>
> I knew that getImage() could
> load an image file from the
> network and paint() could
> display it.
>
> However, I don't know how can I
> get an image which is a local
> file. I tried
>
> Image i = getImage( String filename )
>
> It can not be compiled and the
> compiler said:
>
> Incompatible type for method. Can't convert java.lang.String to java.net.URL.
> i = getImage("houses.gif");
>
> --Simmy
>
> --
> Yuet Sim Lee
>
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]