Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


Java Tutorials



Struts Tutorials

Struts Resources

Visit Forum! Post Questions!
Jobs At RoseIndia.net!

J2me Text Field

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

2 comments so far (post your own) View All Comments Latest 10 Comments:

it is good

Posted by shailesh on Tuesday, 03.9.10 @ 12:08pm | #95415

Text Field Midlet Example

This example illustrates how to insert text field in your form. We are using here two TextField (name and company). We are taking both TextField variable in to the constructor (TextFieldExample) of the class. When application will be run then first of all the startApp() method will called and it display the form with name and company field. The TextField is in the javax.microedition.lcdui package, has the following methods:

delete(int offset, int length)
getChars(char[] data)
insert(char[] data, int offset, int length, int position)
insert(String src, int position)
setChars(char[] data, int offset, int length)
setConstraints(int constraints)
setMaxSize(int maxSize)
setString(String text)
Application display as follows:

Source code of TextFieldExample.java is as follows:

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

public class TextFieldExample extends MIDlet implements CommandListener{
private Form form;
private Display display;
private TextField name, company;
private Command ok;

public TextFieldExample(){
name = new TextField("Name:", "", 30, TextField.ANY);
company = new TextField("Company Name:", "", 30, TextField.ANY);
ok = new Command("OK", Command.OK, 2);

public void startApp(){
display = Display.getDisplay(this);
Form form = new Form("Text Field");

public void pauseApp(){


public void destroyApp(boolean destroy){

public void showInput(){
display = Display.getDisplay(this);
String n = name.getString();
String c = company.getString();
Form form = new Form("Input Value");

public void commandAction(Command c, Displayable d) {
String label = c.getLabel();

Posted by aditya on Saturday, 10.11.08 @ 11:38am | #81010

Ask programming questions?



Back to Tutorial


  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name


Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright 2007. All rights reserved.