This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Is this the right way to load an array of images? So far, so good: you're on the right track. This instantiates the image array but does not actually load the image data. The Toolkit getImage and creatImage methods return immediately, ie, they load synchronously. What you want for image loading is to block program execution until all the images are fully–loaded. To do this we use the MediatTracker class. See the class api for example code and handy methods for checking on the loading status. Also, while we're at it, check out the information for (the Toolkit method) getImage in the (Toolkit) Method Detail section: it explains why getImage may not be the best choice. This is the older way to load images. We have two other, later options: ImageIcon was introduced in j2se1.2 and uses the Toolkit and MediaTracker classes for loading images. One drawback of this appraoch is that it gives no indication/exception if the file is not found or the data is corrupted/not loaded. It's api does provide ways to find out about loading trouble/success. In j2se 1.4 ImageIO was introduced and is the newest way to load images. It throws exceptions for loading trouble.
Joined: Oct 12, 2006
Thank you Craig.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com