Overview of Applets |
Note: If you've already looked at this page, reload the applet to see the example again.The following applet (named Good) has a computation-intensive beginning sequence, implemented as a loop that occasionally prints status. The Good applet does the right thing: Instead of putting the loop in the
init()
orstart()
method, it spins off a thread to do the computation. (Here's the source code.) Notice how quickly (compared to the Bad applet) the browser can display the applet and the rest of the page.
Overview of Applets |