This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
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.
posted 8 years ago
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 ImageIcongetImageLoadStatus method. The MediaTracker api comments section has an example that checks for loading status.