|
-
May 24th, 2005, 01:09 PM
#1
getImage Applet NULL POINTER eXCEPTION
I am having trouble pulling an image from a website. I think that I can use getImage but in the following code, it returns a NULL Pointer Exception.
1)Is this the correct method to use.
2)Any idea as to why I get a NULL Pointer Exception and how would I fix this.
Thanks,
Pedro
import java.applet.Applet; /** DateFormat */
import java.net.URL;
public class A19015url
{
public static void main(String[] args)
{
try
{
String uStr = "http://images.amazon.com/images/P/B0001XANOE.01.THUMBZZZ.jpg";
URL imgURLStr = new URL(uStr);
Applet S = new Applet();
S.getImage(imgURLStr);
}
catch (MalformedURLException errnum)
{
System.out.println(" URL no worky!");
}
catch (IOException errnum)
{
System.out.println("Internet connection is flaky");
}
System.out.println("hiya");
}
}
-
May 24th, 2005, 02:16 PM
#2
Re: getImage Applet NULL POINTER eXCEPTION
Applets are intended for use inside a web page.
If you want to get an image from a URL, you could try something like this
-
May 24th, 2005, 03:43 PM
#3
Re: getImage Applet NULL POINTER eXCEPTION
Thanks Davey, works greatnow I will try to display it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|