Congratulations Vithal Wadje for Completing 100 Articles on C# Corner
Carrer Advice: Success Requires Continuity
C# Corner Q3, 2014 MVPs Announced
Go to all article comments >>
Go to all messages >>
A Code Snippet
An Interview Question
Ask a Question
Visual Studio .NET
Visual Studio 2012
C, C++, MFC
Visual Studio 2013
Algorithms in C#
Printing in C#
WCF with C#
Databases & DBA
Web Services in C#
Reports using C#
Design & Architecture
Multithreading in C#
Security in .NET
Windows Forms C#
Windows Store Apps
How do I
Visual Basic .NET
Internet & Web
Request a new Category
Cookie and Queries string, Session ...
Prevent Partial view to access dir ...
How to Count Total Number of HIT i ...
Pure Redirection using WebRequest ...
All about Singleton Pattern
Congratulations Vithal Wadje for C ...
Saving Values in XML and Retrievin ...
Dynamic Menu in WPF
Design Patterns Introduction
Message Exchange Patterns in WCF
Java Applets and its life-cycle
Sep 28, 2011
In this blog we will know about the java applets and its life cycle.
This is a program, which can create graphical user interface to make visible dynamic content in the web browser. It creates a window for the web content visible inside the web browser. The compiled java program can be loaded into the web browser with the help of html document. To execute the applet in the web browser it must contain java virtual machine. The applet can deal with presentation logic and business logic. An applet does not have main method as the starting point of the execution.
Creation process of applet
Create a class by inheriting java applet. Applet class.
Override the life cycle method of applet such as init (), start (), stop (), destroy () and provide presentation with business logic into these methods.
Create a html file, which must contain the <Applet> tag to load applet into the web browser.
Compile the file and load the html file into the browser.
Using applet viewer tool available in jdk can test an applet corresponding html file.
Life cycle of applet
It is of five types
- This is a method which initializes the applet with the required components inside it. This method executes only once of the life cycle of an applet.
- This method is responsible for activating the applet. This method executes when applet will be restored or visible in the web browser. This method executes more than once in the life cycle of an applet.
- This method can be used to draw different components or graphical shape into the applet. This method can be executed repeatedly during the applet execution.
- When an applet will be minimized or made invisible by using back or forward button of the web browser then the applet will be deactivated by calling this method.
- When the browser containing the applet will be closed then this method will be called. This method execute only once in the life cycle of an applet.
- lifecycle of applet
public class life extends Applet
public void init()
Label lab1=new Label("lifecycle Applet");
public void start()
public void paint(Graphics g)
public void stop()
public void destroy()
<applet code="life" height="200" width="200">
After closing the applet window stop() is called first and then destroy() method finally execute which is shown below in the console.
Playing music using applet in java
History of Java
Collection in java
Classes and Objects in Java
What is Web Container in Java?
Init Block and Static init Block in Java
View Previous Comments >>
Hire Mobile & Web Developer
Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.
Filtering External list in SharePoint 2013
How to Create Razor Function in Asp.Net MVC View?
Default Content Access Account in SharePoint 2013
What is the Use of .noConflict() Method in Jquery?
Draw rectangle on CView and Track using CRectTracker
Show Date and Time withOut Post Back
7 Golden Rules to Impress Your Project Leader
Pure Redirection using WebRequest and WebResponse
SharePoint 2013: Minimal Download Strategy
Limit And Show Char In TextBox using jQuery
CBeyond Cloud Services
TERMS & CONDITIONS
©2014 C# Corner. All contents are copyright of their authors.