Applets are simple Java programs that runs in web browsers.The creation of web pages is related to Java Applet. An applet is an Internet based Java program that can be included in an HTML page.An applet is a Java class defined in JDK’s java. applet package.
In Java,we my use the java.awt.Font class to set or retrieve the screen fonts. The name of the font can be a particular font such as “Arial”, Times New Roman”,etc.We can set the Font by using setFont() of the Graphics class.FontMetrics class is used to know the attributes of font within a program.
We can draw geometrical shapes like rectangle, oval, ellipse etc through a programming language. We will need to set Coordinated through the program or trap the user’s mouse movements to draw at desired position.
The Listener interfaces are defined in java.awt.event package we need to import the java.awt.event package. ActionListener is an interface we need to implements it for our class.
getSize() method is used to find the size of an applet.We can find the height and width(in pixels) of the applet. The paint()method of the Applet class is used to display the result on the screen.