|  Home   |  Contact Us   |  Online Exam   |  Tech World   |  Jobs    |  Member Login
Java Interview Questions
Jdbc Interview Questions
Servlet Interview Questions
Jsp Interview Questions
Struts Interview Questions
Ajax Interview Questions
Webservice Interview Questions
Designpattern Interview Questions
J2me Interview Questions
EJB Interview Questions
Spring Interview Questions
Hibernet Interview Questions
Enterprise IT Training
Java Program Examples
        Sun J2ME Wireless Toolkit          
  Struts Execution Steps  |     RMI Execution Steps  |   Steps to Execute Jsp  |  

step 1 : How To create New Project and run steps:
Create a html page, from that we are going to send request to the server.

The Sun J2ME Wireless Toolkit supports the development of Java applications that run on devices such as cellular phones, two-way pagers, and palmtops.

More information about the Sun J2ME Wireless Toolkit can be found at:

http://java.sun.com/products/j2mewtoolkit/

Setup, build and run Simple Login on Sun J2ME Wireless Toolkit 2.2.
Information
  » To instal Software Sun J2ME Wireless Toolkit 2.2.(or) earlier version.

  » To create a simple Login Applications
Operating system used
Windows XP Home Edition Version 5.1 SP 2
Software prerequisites
Sun J2ME Wireless Toolkit 2.2
Procedure
1.Start "KToolbar".


2.Create a new project, press button "New Project".

3.Enter the following project details:

Project Name: Login Project

MIDlet Class Name: Login



Press button "Create Project".

4.Change the settings for this project:

Tab: API Selection

Target Platform:JTWI

Configurations: CLDC 1.1



5.Press OK button. The project is created.



6.Close KToolbar, menu: File | Exit.

7.You must manually create the project directory: C:\WTK22\apps\Login Project\src

8.Copy and save Login.java file in C:\WTK22\apps\Login Project\src Directory:

Login.java
     import javax.microedition.midlet.MIDlet;

     import javax.microedition.lcdui.*;

     public class LoginMidlet extends MIDlet implements CommandListener {

     private Display display;

     private TextField userName;

     private TextField password;

     private Form form;

     private Command cancel;

     private Command login;

     public LoginMidlet() {      userName = new TextField("LoginID:", "", 10, TextField.ANY);

     password = new TextField("Password:", "", 10, TextField.PASSWORD);

     form = new Form("Sign in");

     cancel = new Command("Cancel", Command.CANCEL, 2);

     login = new Command("Login", Command.OK, 2);

     }

     public void startApp() {

     display = Display.getDisplay(this);

     form.append(userName);

     form.append(password);

     form.addCommand(cancel);

     form.addCommand(login);

     form.setCommandListener(this);

     display.setCurrent(form);

     }

     public void pauseApp() {

     }

     public void destroyApp(boolean unconditional) {

     notifyDestroyed();

     }

     public void validateUser(String name, String password) {

     if (name.equals("amar") && password.equals("amar")) {

     menu();

     } else {

     tryAgain();

     }

     }

     public void menu() {

     List services = new List("Choose one", Choice.EXCLUSIVE);

     services.append("Check Mail", null);

     services.append("Compose", null);

     services.append("Addresses", null);

     services.append("Options", null);

     services.append("Sign Out", null);

     display.setCurrent(services);

     }

     public void tryAgain() {

     Alert error = new Alert("Login Incorrect", "Please try again", null, AlertType.ERROR);

     error.setTimeout(Alert.FOREVER);

     userName.setString("");

     password.setString("");

     display.setCurrent(error, form);

     }

     public void commandAction(Command c, Displayable d) {

     String label = c.getLabel();

     if(label.equals("Cancel")) {

     destroyApp(true);

     } else if(label.equals("Login")) {

     validateUser(userName.getString(), password.getString());

     }

     }

     }
9.Start KToolbar and press button "Open Project".



10.Select project "TeapotM3G" and press button "Open Project".



11.Select the Device. In this example the default device "DefaultColorPhone"

12.Press button "Build" and if no errors are shown, press button "Run".



13.DefaultColorPhone is Displayed on the window



14.To click "Lunch" Button



15.The Login Prroject.jar can be found in C:\J2mewtk\apps\Login Prroject\bin
Back to Top
All Rights Reserved : skdotcom technologies