This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Image Observer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Image Observer" Watch "Image Observer" New topic

Image Observer

liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
I'm implementing/attempting to implement Image Observer in a servlet to draw an image

and have implementation for the method imageUpdate( java.awt.Image image, int flags, int x, int y, int width, int height).
The method does get called and executed. In log, I can see it attempting to wait for the .drawImage call to finish, but the image never gets drawn.
Does anyone know anything about this? Thanks in advance.
Here is the imageUpdate - The lines that show up in the log are 0,4 and 7 - AND NOTHING ELSE!
Romain Guy
Ranch Hand

Joined: Sep 18, 2007
Posts: 47
Instead of using an ImageObserver you can make sure that all of your image instances are instances of BuffereImage. A BufferedImage, contrary to the ToolkitImage, is guaranteed to be loaded synchronously.
Chet Haase
Ranch Hand

Joined: Aug 16, 2007
Posts: 32
Also note: when you do use a BufferedImage (which, for instance, is created for you if you load images via ImageIO, or which you can create from scratch in various ways), then you should pass null as the ImageObserver argument to drawImage:


Book: <a href="" target="_blank" rel="nofollow"></a> <br />Java: <a href="" target="_blank" rel="nofollow"></a> <br />Humor: <a href="" target="_blank" rel="nofollow"></a>
wood burning stoves
subject: Image Observer
Similar Threads
problem while displaying multipage tiff image in applet
Resizing Large JPG Problem
Java- Image height required
Image Dimensions
why is an interface's varable static, and a method not allowed to be static?