Delhi Developer’s Day: Learn ASP.Net vNext , HTML5, MVC, Hybrid Apps in Windows and Deferred Object Materialization
New Feature: Mention your friends and followers
Go to all article comments >>
Go to all messages >>
A Code Snippet
An Interview Question
Ask a Question
Printing in C#
Visual Studio 2010
Visual Studio 2012
Databases & DBA
Visual Studio 2013
WCF with C#
Design & Architecture
Mobile & Embedded
Reports using C#
Multithreading in C#
Web Services in C#
Games Programming C#
How do I
Windows Forms C#
Internet & Web
Windows Store Apps
Visual Basic .NET
Visual Studio .NET
C, C++, MFC
Request a new Category
Categories of Sql Commands
Deserialize a nested json in c#
Rotate an Image Based on the User ...
How to check if the user exists in ...
Access Model State Property within ...
How to hide the page tab using Jav ...
Difference between Claims-based Au ...
Web Service Availabilty Check
Update Logout Time in Database whe ...
Open PopUp on Button Click Using J ...
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.
Diffrent Ways to Implement Dispose Patterns/Methods in Your SharePoint Code
How to extend a content DB for single web application using SHarePoint 2010 UI
Open PopUp on Button Click Using JQUERY
Introduction to Search Administration Component in SharePoint 2013
Introcution to Query Processing Component in SharePoint 2013 Search
What is Index Component in SharePoint 2013 Search
Understanding SAML Token-Based Authentication in SharePoint 2013
OAuth 2.0 in SharePoint 2013
Website under maintenance
Round Button in WPF
CBeyond Cloud Services
TERMS & CONDITIONS
©2014 C# Corner. All contents are copyright of their authors.