This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hello, 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!
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.
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: