![]() |
GIF display applet |
This example is an applet which displays an image, typically a GIF file, scaled to fit the size of the applet window.
Here's the source, as a plain ASCII file.
The applet requests an image (specified by its name, relative to the document from which the applet is invoked). It then uses the Java MediaTracker to wait until it has completely arrived. The image is then displayed. The only parameter is the name of the image.
The applet is compiled using the same steps as for the 'Hello World' applet. To have the applet displayed in World Wide Web page, you need to
<applet code="GifShow.class" width=200 height=150> <param name=gif value="netrexx.gif"> </applet>
which sets the maximum size for the window in which the applet will appear, and the name of the image.
You can then view the page with any Java-enabled browser, or with the
'applet viewer' that comes with the Java Development Kit. If you are
using such program, you should see the applet below here.
For more details on running applets, see the Hello World applet page.
[ NetRexx | IBM home page | Search | Contact IBM | Help | Legal ]
This page was created on 3 Aug 1997; it can be found from http://www2.hursley.ibm.com/netrexx/