This example show to create the Midlet application for user login . All Midlet applications for the MIDP ( Mobile Information Device Profile) derived from Midlet class and it play a role as a mediator between the application and the environment in which the application runs. The Midlet life cycle manage the flow of application. It is in the javax.microedition.midlet package, so import this package in your application. The javax.microedition.icdui package is used for following classes:
Alert AlertType Canvas ChoiceGroup Command DateField Display Displayable Font Form Gauge Graphics Image ImageItem Item List Screen StringItem TextBox TextField Ticker In this example we will create a Midlet (LoginExample), that will show following output display look like below:
Click on 'Launch' Button then the login page display like below:
Give Your LoginID 'sandeep' and Password 'sandeep' then it call the commandAction where if condition will be executed and it calls a function (validateUser()) which checks whether name and password is equal to 'sandeep' or not if it equal to 'sandeep' then it executed the showMsg() function which show a congratulation message but if name and password is not equal to 'sandeep' then it call tryAgain() function which show the error page like figure below and it return on login page with refresh value.