Images and sound clips are always loaded asynchronously. As a result loading may not be complete when the applet tries to display the image. (Partially loaded images can be displayed.)
Image im = getImage(url);
Mediatracker tracker = new MediaTracker(this); // start loading image(s) boolean fetchImages(Array imageurls) { for (int i=0; i<imageurls.length; ++i) { images[i] = getImage(imageurls[i]); // give tracker id of 0 tracker.addImage(im, 0); } // now wait until all images loaded try { tracker.waitForID(0); } catch (InterruptedException e) {} return !tracker.isErrorID(0);
AudioClip clip = getAudioClip(url);An audioclip can be played once with play() or continuously with loop(). Playing starts when the clip is completely loaded.