Article View: borland.public.jbuilder.java.language
Article #17894Re: Waiting for an image to load
From: Brian Lauridsen
Date: Thu, 17 Sep 1998 00:00
Date: Thu, 17 Sep 1998 00:00
23 lines
1194 bytes
1194 bytes
The java.awt.MediaTracker class is there for that:
MediaTracker mt = new MediaTracker(this);
mt.addImage(image_to_wait_for, 0); // add image with ID 0
try {
mt.waitForID(0); // Wait for all images added with ID 0
} catch (InterruptedException ie) {
System.out.println("Unable to load image: " + ie.getMessage());
}
Doug McClary wrote:
> Does anyone have a suggestion for waiting/knowing when an AWT Image has
> finished loading. I've tried :
>
> while (!prepareImage(.....) {}
>
> but this seems to cause an out of memory error for large images.
>
> Regards
>
> Neil.
Technical Details
Message-ID:
<3600FDCD.9A472CB0@yp.aas.dk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<35FFD19D.23258EDD@vx-1.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,63cbba21d46a2160 X-Google-Attributes: gidf74b3,public From: Brian Lauridsen <lind@yp.aas.dk> Subject: Re: Waiting for an image to load Date: 1998/09/17 Message-ID: <3600FDCD.9A472CB0@yp.aas.dk> X-Deja-AN: 392027618 Content-Transfer-Encoding: 7bit References: <35FFD19D.23258EDD@vx-1.com> To: Doug McClary <dwmcclary@vx-1.com> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language