Top 10 Career Advice by C# Corner Experts
Delhi Developer’s Day Sep 13, 2014: Learn ASP.Net, HTML5, Dependency Injection and Universal Applications
Go to all article comments >>
Go to all messages >>
A Code Snippet
An Interview Question
Ask a Question
C, C++, MFC
Visual Studio 2010
Visual Studio 2012
Visual Studio 2013
Databases & DBA
Reports using C#
WCF with C#
Design & Architecture
Mobile & Embedded
Web Services in C#
Multithreading in C#
Files, Directory, IO
Games Programming C#
Windows Forms C#
How do I
Windows Store Apps
Internet & Web
Visual Basic .NET
Visual Studio .NET
Request a new Category
Creating Log file in PowerShell Script
Converting Collection to Dataset
Aggregate in LINQ
Count vs Any
How to search content from specifi ...
Unbelievable Cool Games Made in Mi ...
Understanding Twitter Engagements
Article Header Changed for Author ...
Basic operations on Lists with the ...
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.
Handling Dynamic Control Names in Asp.Net
Auto-Suggest Column in SharePoint 2010 using SPServices
Poll for a file in server path in c#
Basic operations on Lists with the SharePoint 2013
Unbelievable Cool Games Made in Microsoft Excel
Creating Log file in PowerShell Script
Find User Group in SharePoint 2010 using spservices
How to use AJAX Control Toolkit with SharePoint 2010 custom Webparts
CBeyond Cloud Services
TERMS & CONDITIONS
©2014 C# Corner. All contents are copyright of their authors.