For Programmers: Free Programming Magazines  


Home > Archive > Java Help > August 2005 > Applet requires page refresh









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Applet requires page refresh
Chris Clarke

2005-08-16, 5:08 pm

Hello,
I am relatively new to Java and have written an Applet which include Images,
but when my browser (IE6) loads the Applet, my GIFs are not displayed until
I refresh the page? What do I need to do?
The lines in question are:

public void init() {
WP = getImage(getCodeBase(),"WPawn.GIF");
....
}

and

if (pos[rw][cw]=='P') g.drawImage(WP, xOffset+c*50, yOffset+r*50+2,
null);

The program works fine once the page has been refreshed, but surely I
shouldn't have to refresh? Can anybody help?


Andrew Thompson

2005-08-16, 5:08 pm

On Tue, 16 Aug 2005 16:09:07 +0000 (UTC), Chris Clarke wrote:

> I am relatively new to Java


You are posting to the right group..

>...and have written an Applet ..


...but coming in at the wrong end!
<http://www.physci.org/codes/javafaq.jsp#appfirst>

>...which include Images,
> but when my browser (IE6) loads the Applet, my GIFs are not displayed until
> I refresh the page?


Images load asynchronously.

> ..What do I need to do?


Wait. See the ImageObserver interface or MediaTracker.

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Not a word, could I relate. The story was quite clear.." Led Zeppelin
'Kashmir'
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com