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.
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...
Originally posted by Richard Boren: Are you doing it like this? int imageWidth = anImage.getWidth( this ) ; int imageHeight = anImage.getHeight( this ) ;
yes, I am doing like this. First time, I am getting -1 and second time i am getting proper width and height Thanks
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).]
Post by:autobot
It was the best of times. It was the worst of times. It was a tiny ad.
a bit of art, as a gift, the permaculture playing cards