Java, applet.Applet class provides the extension for every applet. The main applet class has a method that can be derived from the applet class called to obtain the data & the services from the web browser context.
The method includes,
Applet can be invoked by embedding directive in HTML file & displaying the file through applet viewer.
The <applet> tab has a basis for embedding applet in HTML file. Let understand using the below example to invoke the “MyApplet” applet.
<html> <title>The Hello, world Applet</title> <applet code = "MyApplet.class" width = "320" height = "120"> If your browser was java-enabled, "Hello, world" message would appear here. </applet> </html>
The code attribute of <applet> tag is used. It uses to run the apple class. the width & height are also required to mention the initial size of the panel in which the applet can run. The applet directive should be closed with the </applet> tag.
If applet takes the parameter, values that might be passed for the parameter by add <param> tag between the <applet> tags. The browser ignores the tags in between the applet tags.
Java must be enabled in the browser to run the applet. so a non-java-enabled browser can not process the applets.
Applets have a list of event handling methods from the container class. the container class can have several methods i.e. processKeyEvent & ProcessMouseEvent to handle a particular type of the event & one catch all the method call the processEvent.
In order to respond event, the applet should be overriding the appropriate event-specific method.