Meaningless Drivel is fun!*
The moose likes Applets and the fly likes Applet images Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet images" Watch "Applet images" New topic
Author

Applet images

jack nick
Ranch Hand

Joined: Jan 11, 2001
Posts: 96
Hello there,
Now I seem to be having a real strange problem. I have an applet with is has 4 images all of which I am loading together, when I mean loading I mean getting the images into an image object.
The problem occurs when the applet is loaded for the first time. One of these images dont seem to come up everytime. For some strange reason when the repaint method is called on click of a reset button, this missing image appears.
Could anybody help me stop pulling my hair as to why this irational behaviour.
Thks,
Jack
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
It's actually not irrational behavior, but it sure can seem that way when experienced for the first time.
Take a look at java.awt.MediaTracker and see if you don't get an idea as to what's going on and how you can better control the display of your images.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
jack nick
Ranch Hand

Joined: Jan 11, 2001
Posts: 96
Gee thanks mate, this sure works fine now. Just one thought baffling though is as to why out of the 4 images it was always a particular one that was bumming up. Checked the fact that all my images were of the same size, width and height. Could there be any specific reason cos thought it works perfect, i am still curious as to why this happens.
jack
jack nick
Ranch Hand

Joined: Jan 11, 2001
Posts: 96
hi there,
i must be going blind, guess what my code already did have the media tracker somewhere in that big spagetti code that i had to debug and guess which images was missing to be added to the media tracker. - the cancel button. now this solves my problem completely. Thanks dirk.
Jack
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet images