CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2005
    Posts
    2

    Wink 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");
    }
    }

  2. #2
    Join Date
    Sep 2004
    Posts
    247

    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

  3. #3
    Join Date
    May 2005
    Posts
    2

    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
  •  





Click Here to Expand Forum to Full Width

Featured