Hi all,
My first post on these boards so greetings to all. I have the following applet which is supposed to fetch a big image via url and render it on an applet using drawImage. I want my applet to render the image in an incremental fashion as the image is loaded (which is supposed to be the defualt manner by which drawImage works). I also learned that there must be a System Property awt.image.drawIncremental which should be set to true so that incremental drawing can be enabled (I had to set it manually as it was defaulted to false)
However the image is still being rendered when all image bytes are loaded from the URL. Here is my code:
import java.applet.*; import java.awt.*; import java.awt.image.ImageObserver; import java.io.IOException; import java.net.URL; public class imageApp extends Applet { Image image; public void init () { System.setProperty("awt.image.incrementalDraw", "true"); incrementaldraw = Boolean.getBoolean("awt.image.incrementalDraw"); System.out.println(incrementaldraw); //Verify incrementalDraw is set to true try{ URL url = new URL("http://geoeyemediaportal.s3.amazonaws.com/gallery/Inauguration_2009.jpg"); image = getImage(url); } catch(IOException e){} } public void paint (Graphics g) { g.drawImage (image, 0, 0, this); } public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { if ((infoflags & SOMEBITS ) != 0){ repaint(); } return super.imageUpdate(img, infoflags, x, y, width, height); } }
I would greatly appreciate some help from you guys as I am at a loss. Thanks everyone