| previous |
MediaTracker
void loadImages() {
// Create a MediaTracker
MediaTracker tracker = new MediaTracker(this);
// Declare variables for the URLs
URL appletLocation = getCodeBase();
URL imageURL = null;
try {
// Start loading the graveyard image
imageURL = new URL(appletLocation +
"/images/boothill-blue.jpg");
graveyard = getImage(imageURL);
tracker.addImage(graveyard, 0);
// Start loading the skull image
imageURL = new URL(appletLocation +
"/images/skull-1.gif");
skull = getImage(imageURL);
tracker.addImage(skull, 0);
}
catch (MalformedURLException e) { e.printStackTrace(); }
// Wait for the images; does no error checking
try { tracker.waitForAll(5000); }
catch (InterruptedException e) {}
}