Applets by Example
Okay, we still have a few more things to talk about before you actually build your own applet.
However, let's look at a simple applet so you can see what it would look like.
Notice that we have to import the applet package.
import java.awt.*;
import java.applet.*;
public class Hello extends Applet
{
public void init()
{
System.out.println
("We have been initialized");
}
public void start()
{
System.out.println("We have been started");
}
public void stop()
{
System.out.println("We have been stopped");
}
public void destroy()
{
System.out.println("We have been destroyed");
}
}
NEXT
Selena Sol contributes to the JavaBoutique's Introduction to Java. Selena curently works for Barclays Capital in London, one of the leading global investment banks in Europe and has worked as a software developer for the National Center for Human Genome research, Microline Software, Neuron Data, and Electric Eye in Singapore. Selena is perhaps best-known for creating the Public Domain Web Script Archive (Extropia) and writing several books on Web Programming (Perl, CGI, Java).
Email: selena@extropia.com
|