Try the ImageIO class's read method.

If you want to keep the existing code, look at the MediaTracker class.