Hi, Hope you are doing well.
This Post is focused on Applet in java. Java has wonderful concept "Applet". We all know Java is so popular in IT field.
Let's start with short introduction of applet.
Introduction
An applet is a special kind of Java program that runs in a Java enabled browser. This is the first Java program that can run over the network using the browser. Applet is typically embedded inside a web page and runs in the browser.
In other words, we can say that Applets are small Java applications that can be accessed on an Internet server, transported over Internet, and can be automatically installed and run as apart of a web document.
Simple Applet
import java.awt.*;
import java.applet.*;
public class Simple extends Applet
{
public void paint(Graphics g)
{
g.drawString("A simple Applet", 20, 20);
}
}
Every Applet application must import 2 packages - java.applet. & java.awt.
1. Abstract Window Toolkit (AWT) classes are imported by java.awt.*.
Applets communicate (directly or indirectly) via the AWT with the client.
The AWT includes support for a GUI based on a window. Java.applet.* imports the Applet package containing the Applet class.
Any applet you generate must be an Applet class subclass.
Lifecycle of Java Applet
Following are the stages in Applet
Applet is initialized.
Applet is started
Applet is painted.
Applet is stopped.
Applet is destroyed.
Explaination of stages in Applet:
init() : init() is the first method to be called. This is where variable are initialized. This method is called only once during the runtime of applet.
start() : start() method is called after init(). This method is called to restart an applet after it has been stopped.
stop() : stop() method is called to suspend thread that does not need to run when applet is not visible.
destroy() : destroy() method is called when your applet needs to be removed completely from memory.
Advantages of Applets
It takes very less response time as it works on the client side.
It can be run on any browser which has JVM running in it.
How CodersArts can help you in Applets?
CodersArts provide
Applet Assignment help
provide instant help
Doubt clearing session
Mentorship from java Applet Expert
If you are new in Applet or have any problem in Applet, Contact us
Comentarios