This website includes Education Information like a programming language, job interview question, general knowledge.mathematics

Education log

PageNavi Results No.

Ads

Tuesday, February 2, 2021

what is Java applet lifecyle applet with example

 what is Java applet lifecyle applet  with example


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.


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.



Java Applets

Applets are small Java applications which can be accessed on an Internet server, transported over the Internet, and can be installed and run automatically as part of a web document. 

The applet can create a graphical user interface after a user gets an applet. It has restricted access to resources so that complicated computations can be carried out without adding the danger of viruses or infringing data integrity. 

Any Java applet is a class that extends the class of java.applet.Applet. 

There is no main() methods in an Applet class. Using JVM it is regarded. The JVM can operate an applet application using either a Web browser plug-in or a distinct runtime environment. 

JVM generates an applet class instant and invokes init() to initialize an applet. 



What is meant by applet in Java?

Java applets are used to provide interactive features to web applications and can be executed by browsers for many platforms. They are small, portable Java programs embedded in HTML pages and can run automatically when the pages are viewed.



What is applet and its types?

Types of Applets: Web pages can contain two types of applets which are named after the location at which they are stored. Local Applets: A local applet is the one that is stored on our own computer system. Remote Applets: A remote applet is the one that is located on a remote computer system



A Simple Applet programe example

import java.awt.*;

import java.applet.*;

public class Simple extends Applet

{

  public void paint(Graphics g)

    {

      g.drawString("A simple Applet", 20, 20);

    }

}


No comments:

Post a Comment