| Author |
Potential problems with getImage()
|
colin shuker
Ranch Hand
Joined: Apr 11, 2005
Posts: 712
|
|
Hi there, I get my images using... But I'm thinking, what happens when the image at the location 'path' is not there. Well, I expected the image to be null, but when I tried it: Which isn't null. So what happens if I now try to use the image, could I get an exception? I tried it, and there was no exception, just black where the image should have been drawn. Well having black replace the image is fine, but I don't know how I should handle this situation correctly since it seems no exception is thrown, so I can't use a try/catch. Its not that I want it to do anything when there is no image to fetch, I just don't want it to break if this happens. Thanks for any input.
|
 |
Craig Wood
Ranch Hand
Joined: Jan 14, 2004
Posts: 1535
|
|
This statement creates an Image object and loads the image data using a MediaTracker (protected field). To get feedback about the loading process you can use the ImageIcon getImageLoadStatus method. The MediaTracker api comments section has an example that checks for loading status.
|
 |
 |
|
|
subject: Potential problems with getImage()
|
|
|