How to keep re-reading the same image file in Applet

C

Clive

Hi,

I have written (copied) a simple applet that reads a JPG from the server and
paints in on the Applet.

I have another application that is continusly updating the JPG image on the
server.

What I would like to do is have the Java Applet download the JPG on a timer
and display the changed image.

But all that happens is the first time it runs it picks up the image and
displays OK, but the second time it just displays the same image unless I
refresh my browser, I can only assume the browser has cached this image for
me.

I have tried image.flush() but that doesnt seem to work.

Is there anyway to force the applet to reread the image again from the
server?. Little bit of sample code would be lovely.

Cheers
Clive.

heres what I have so far

//Draw the current frame of animation.
public void paint(Graphics g) {
Dimension d = size();
int appw = d.width;
int apph = d.height;

bigimg = getImage(getCodeBase(), "0535582.jpg");
g.drawImage(bigimg, 0, 0, appw, apph, this);
// bigimg.flush();

// g.drawString("Frame " + frameNumber, 0, 30);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top