VOICE: How I become C-Sharpcorner Addict?
CAREER ADVICE: Aiming high - How to reach the top
Jabalpur Chapter Meet Official Recap: 19 July, 2014
Go to all article comments >>
Go to all messages >>
A Code Snippet
An Interview Question
Ask a Question
Visual Studio .NET
Visual Studio 2010
Databases & DBA
Visual Studio 2012
Reports using C#
Visual Studio 2013
Design & Architecture
WCF with C#
Files, Directory, IO
Mobile & Embedded
Web Services in C#
Games Programming C#
How do I
Multithreading in C#
Windows Forms C#
Internet & Web
Windows Store Apps
Visual Basic .NET
Request a new Category
Aiming high - How to reach the top
How to Select Column Values as Com ...
Abstract Class in C#
5 Microsoft Dynamics CRM Online Sp ...
Thank you 'Yourstory' for covering ...
How to Create Nokia X App
How to join webinar (Web+Seminar)
Loop through Model items in ASP.NE ...
No Data tab in Azure Mobile Servic ...
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 >>
Type your comment here and press Enter Key....
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.
State Management in ASP.NET
Stored Procedure VS Function
Adding Deployment Administrator in MS CRM Online
How do I Convert Word Doc to PDF using GMail On Chrome
Thank you 'Yourstory' for covering my unsung background
Aiming high - How to reach the top
what is Dirty Read?
No Data tab in Azure Mobile Services: Solved
Search varchar data in all column SQL server 2008
5 Microsoft Dynamics CRM Online Spring ‘14 and Microsoft Dynamics CRM 2013 Service Pack 1 Features
CBeyond Cloud Services
TERMS & CONDITIONS
©2014 C# Corner. All contents are copyright of their authors.