File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion 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>
I agree. Here's the link:
subject: Image Observer
jQuery in Action, 3rd edition