Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of


We use a JPanel subclass ....

set as contentpane ....

to draw upon.

This applet starts by asking the browser to initiate transport of the trans.gif picture that resides in the same directory on the same host as where the applet itself (the code) came from :

It doesn't wait for the picture to arrive, but continues by showing the height value of the java.awt.Image object at that moment :

Probably -1 : not known yet.

The browser is asked to get the second picture :

Two standard picture formats are used : gif and jpg. The png format can also be used.

For drawings and text-pictures the gif format is most suited.

For (photographic) pictures jpg is better suited, giving you the opportunity to choose between quality and file-size.

You'll notice the paint method being called several times without the program's interference. This is done by independent threads involved in the transport of the images.

The first image is drawn with its top-left corner at 150,150 on the applet itself, having its proper size as soon as this is known, that is, when transport has been completed.

The same image is drawn from 10, 20 with a width and height of 75.

The second image is positioned at 5, 160 having its original width and height.

A pointer to the applet instance.




getCodeBase returns the URL where the applet came from.

getDocumentBase returns the URL where the HTML came from.

These are Applet-specific so they CAN NOT be used in a STAND-ALONE application !

Neither can stand-alone applications use Applet.getImage, they should use this getImage method instead.


Chopin was already rather ill at the time this photograph was made. This combined with the time it took in 1848 to make it, explains his expression.