Xlet Programming
What is Xlet
Xlet is like an applet dependent of AWT, and the lifecycle of Xlet application can be managed from application manager (xletManager).
Xlet is a clearly defined lifecycle model, managed by lifecycle manager (Xlet Manager). Lifecycle is a state change between start, pause, continue, and destroy.
When Xlet application will have GUI, XletManager will be able to manage screen operation of Xlet application by following a strategy provided by Xlet Manager.
Comparison between stand-alone application and Xlet
Difference between an application started from general main() method (stand-aslone application ) and Xlet application are sought.
1 Xlets must have GUI, whereas standalone application may have or may not have GUI.
2 The lifecycle of Xlet is init, start, stop and destroy, whereas for stand-alone application there is main and exit only.
3 It is possible to run multiple Xlet applications, and Xlet applications can be managed by XletManager, whereas for stand-alone application, basically there will be 1 application for 1 Virtual Machine.
Lifecycle of Xlet
Xlet has 4 states and methods are called according to the changes of the state.
When Xlet is loaded by Xlet Manager it gets ’s pPaused and Active states repeats, until it is Destroyed, from where it cannot recover. Transition to the next state is not completed until the method executed according to the state change is completed.
1 Initialized state(Loaded)
XletManager executes default constructor to generate and instance of Xlet application, but it is not initialized. Each Xlet instance is transferred to this state only once.
2 Pause state (Paused)
a. Xlet is initialized, and paused with the minimum performance, at this state applet releases it’s recourses.
3 Active state(Active)
a. Xlet is executed normally, providing its service.
4 Destroy state(Destroyed)
Xlet destroys itself, and releases the resources. Each Xlet instance is transferred to this state only once.
Xlet Lifecycle Functions
a. void initXlet (XletContext)
b. void startXlet()
c. void pauseXlet()
d. void destroyXlet(boolean)
What is Xlet Manager
Xlet manager is like a application manager it manages various states of Xlet lifecycle, and the communication between different xlets.
a. Xlet manager know the state of Xlet at given point of time.
b. XletMnager can Change the state of Xlet at any time
c. XletManager can Destroy Xlet at any time
Cautions
Lifecycle methods of Xlet interface must be implemented thread-safe. That is, they must be synchronized.
Start with Xlet Programming

Note : In the init Method we need to get the reference of the Root container which we can’t create directly. Then we check if it is found thean we cast it into Frame object and thean use that frame to create GUI and other required programming.
Author:
By Sukhdarshan Atwal
Sukhdarshan Atwal is working as a Sr. Software Programmer at Semaphore Infotech Pvt. Ltd, India. He has more than 4.5 years Experience in JAVA, J2ME, ASP.NET, PHP . You can contact on email: darshan@semaphore-software.com.


