Hi Angela, You are kidding right? It probably took you longer to type the question then to look at the API for java.awt.image. Just to make it simple for you allow me to give you a short cut: ShortCut to java.awt.image API Regards, Manfred.
Joined: Nov 27, 2000
Thanks Manfred, I looked API. I did it. IT's not working. It doesn't allow me to compile. Error is "can't fine ImageObserver though i add the class. That's why I am asking simple example Thanks Angela
I don't know if this will help ( because I have no idea what you are actually trying to do... ), but I have noticed that sometimes width and height of images return 0 because they are not loaded at the time you are trying to get these attributes. Running the image through a MediaTracker will fix this, though...
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Then it looks like my suggestion would solve your problem... before trying to read the width and height values, run the gif through MediaTracker. Normally, an image is not fully loaded into the JVM before it is actually painted to the screen. Loading an image with MediaTracker forces the image to be loaded into the JVM before being displayed. [This message has been edited by Nathan Pruett (edited July 03, 2001).]