Another Java question

Discussion in 'Archived Threads 2001-2004' started by Jay H, Apr 17, 2002.

  1. Jay H

    Jay H Producer

    Joined:
    Mar 22, 1999
    Messages:
    5,654
    Likes Received:
    33
    Trophy Points:
    0
    Location:
    Pittsfield, MA
    Real Name:
    Jay
     
  2. Bill Slack

    Bill Slack Supporting Actor

    Joined:
    Mar 16, 1999
    Messages:
    837
    Likes Received:
    0
    Trophy Points:
    0
    "getImage

    public Image getImage(URL url,

    String name)

    Returns an Image object that can then be painted on the screen. The url argument must specify an absolute URL. The name argument is a specifier that is relative to the url argument.

    This method always returns immediately, whether or not the image exists. When this applet attempts to draw the image on the screen, the data will be loaded. The graphics primitives that draw the image will incrementally paint on the screen.

    Parameters:

    url - an absolute URL giving the base location of the image.

    name - the location of the image, relative to the url argument.

    Returns:

    the image at the specified URL.

    See Also:

    Image" -- Java API Documentation

    Doesn't return 'null' if it doesn't exist. It must actually create a (0,0) image? You could check whether the height or width is 0, which would mean there is no data, but it apparently does instantiate it, no matter what.

    I'm just going off the documentation here, I've not tried this myself.
     
  3. Jay H

    Jay H Producer

    Joined:
    Mar 22, 1999
    Messages:
    5,654
    Likes Received:
    33
    Trophy Points:
    0
    Location:
    Pittsfield, MA
    Real Name:
    Jay
    Yahh, I swear to the Java Gods I thought it said it returns Null, it could possibly be another getImage from another class... Oh well, I thought I was going crazy for a second. I am using a check to Img.getWidth(this) == -1 to see if there is an image or not. It works fine...

    Thanks,

    Jay
     

Share This Page