Results 1 to 2 of 2
  1. #1
    barkster is offline Member
    Join Date
    Jan 2008
    Rep Power

    Default Detect loading of ImageIcon from URL?

    I'm pretty new to java, I'm trying to detect if an image gets loaded or not, don't know how to do that. I thought by catching the url command it would do it but if you link to an image that doesn't exist it doesn't throw and exception. How can I either detect if url was correct or if icon exists? Thanks

    Java Code:
           where = new URL("");
    ImageIcon icon = new ImageIcon(where);

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Rep Power


    ImageIcon doesn't tell you if an image file could not be found or if image data is corrupt or unreadable. It does have a method getImageLoadStatus which you can use to investigate loading problems/success. methods throw exceptions.

Similar Threads

  1. Replies: 0
    Last Post: 01-20-2008, 07:07 AM
  2. Loading An Image Help Please!
    By shaungoater in forum Java 2D
    Replies: 2
    Last Post: 01-09-2008, 09:14 AM
  3. copy image/imageicon into a file on disk
    By archanajathan in forum Advanced Java
    Replies: 2
    Last Post: 11-22-2007, 07:21 AM
  4. Help Loading Up Pictures
    By marco in forum Java Applets
    Replies: 3
    Last Post: 08-14-2007, 10:32 PM
  5. Detect TimeOut in a HttpURL Connection
    By Ed in forum Advanced Java
    Replies: 2
    Last Post: 07-02-2007, 04:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts