Life Cycle of an Applet
Each Java applet goes through a sequence of stages. They are created (initialized), displayed (painted), paused while off screen (stopped,started) and finally removed (destroyed) when over.
Initialization occurs when the applet is first loaded. Tasks performed here are creating objects,setting initial state, loading images, fonts, etc. and setting parameters. The method used is init()
Display is how things are drawn on screen whether it is text, graphics or background. Redisplay occurs many time through the life of an applet. The method used is paint().
Stopping occurs when one leaves a page that contains a running applet. Threads normally continue running but can be manually stopped. The method used is stop().
Starting occurs after initialization and after stops occur. Tasks include starting threads, sending messages to helper objects, or to tell the applet to start running. The method used is start().
Destruction cleans up an applet before the browser exits. Tasks include thread stopping. Normally the method destroy() is not overridden.
Cautions About Applet Use
The greatest problem with using applets is the nonstandard way browsers cope with them. Some browsers support Java natively (ie. self contained). However this leads to version compatibility issues. Other browsers allow applets to be passed through to the Java engine of the viewer's operating system. But this requires that the viewer download and install Java. Are your website visitors this sophisticated? And finally there are ancient browsers like MSIE6 which really makes you jump through the hoops to hook up an installed Java environment. Most browsers also open a box that will overwrite any text that the box is scrolled to (ie a hign z-index value). At this point Java Script looks like a more consistent method of utility delivery!
For security purposes, Java applets allow NO access to user resources! Local files can not be accessed. Printers can't be used. Only the current website server can be communicated with. If your project can live with those restrictions then an applet may be more appropriate than an application.
SUBSCRIBE VIA eMAIL
Recent Posts
Archives
- December 2008 (5)
- November 2008 (15)
- October 2008 (17)
- September 2008 (9)
- August 2008 (12)
- July 2008 (19)
- June 2008 (22)
- May 2008 (17)
- April 2008 (2)
Categories
- java.sql (19)
- Examples (18)
- INTRODUCTION (9)
- JAVA APPLET (9)
- java.awt (8)
- java.net (8)
- java.beans (7)
- JAVA String Utility (6)
- Arrays (4)
- java.math (3)
- java.util.regex (3)
- Sort (2)
- Swing (2)
- java.security (2)
- java.util.zip (2)
- Catching Exceptions (1)
- Classes and Objects (1)
- Core Java Programs-part 1 (1)
- Core Java Programs-part 2 (1)
- Core Java Programs-part3 (1)
- Criticism of Java programming language (1)
- Falling Letters (1)
- File I/O and Streams (1)
- Fun With Letters and Words (1)
- Get current working directory (1)
- How do I convert String to Date object? (1)
- How do I convert string into InputStream? (1)
- How do i calculate directory size? (1)
- How to make executable jar files in JDK1.3.1? (1)
- Interfaces (1)
- JAVA Date Utility (1)
- Java Arithmetic Operators (1)
- Java Assignment Operators (1)
- Java Boolean Operators (1)
- Java Command Line Arguments (1)
- Java Comments (1)
- Java Conditional Operators (1)
- Java Data and Variables (1)
- Java Hello World Program (1)
- Java If-Else Statement (1)
- Java Increment and Decrement Operators (1)
- Java Loops (while (1)
- Java Relational Operators (1)
- Java Variables and Arithmetic Expressions (1)
- Java Virtual Machine (1)
- Know the current position of cursor (1)
- Letters (1)
- Methods (Includes Recursive Methods) (1)
- Rotating Lines (1)
- Send an email with attachment (1)
- Use for..each in Java (1)
- What is Autoboxing? (1)
- Write text file (1)
- connection to database (1)
- do-while and for loops) (1)


0 comments:
Post a Comment