Drawing Images problem

Well, here is my problem: I have a signed applet that loads images (lots of), build a canvas that contains each one and throw them in a container. All the images are loaded pretty well but the creation of the canvas takes too long. Sometimes only a few are loaded and then the applet hangs. If I open the Java Console he (the applet) will be active again, load a few more canvas (with image inside) and then hangs. If I press "T" (to show the threads) he will load some more ... This behavior depends on what? Why can I load images in seconds and a poor canvas takes so long? If anyone encountered this type of problem, please reply. Thank you for your attention, Ady [This message has been edited by Adrian Muscalu (edited August 02, 2000).]

Adrian, May I ask how you are able to isolate that it is the rendering of the canvas and not the loading of the lots of images that is yielding this behaviour ? IMO I would suspect that it could be the loading of the images themselves, if you had not said you are pretty sure it is the canvas. I know applets have the tendency to start displaying images before they are fully loaded.Whatever the cause of your situation, may I suggest, if you have not already done so, to use mediatracker to ensure that ALL the images are loaded before the system attempts to display any one of them or to render the canvas... Herbert.

Adrian Muscalu
Ranch Hand

Joined: May 08, 2000
Posts: 73

posted Aug 03, 2000 10:24:00

0

Thank you for your reply, Herbert. I load images in "for" statement and I receive a "System.out.println" after each image has been loaded. After all this images are loaded, there is another "for" statement that creates instaces of the class that contains images (extends canvs). That's the way I figured out that not the images loading cause problems (I use MediaTracker anyway). There is still a strange fact that the creating canvases process seems to be unlocked by an "signal" send by JavaConsole window. Isnt't it strange? The class that contains the image (extends canvas) have a lot of String variables, one thread, a few int and double... May be an issue of overloading? I guess not. Regards, Ady

Herbert Maosa
Ranch Hand

Joined: May 03, 2000
Posts: 289

posted Aug 03, 2000 14:38:00

0

I guess it is really strange. I am failing to figure out what this could be.....If you have adequate system resources for all the objects you are creating, the threads, the lots of images, then should have some behaviour with acceptable stability. I have a funny idea,....why dont you try creating the canvas instances, without the images and see if there is a change in behaviour.......Just last kicks of dying horse Herbert