You are on page 1of 2

Mobile Programming Laboratory Manual 2 Addis Ababa University, Institute of Technology,

February 2015, - Prepared by Eyob Gebretisnae. Centre of Information Technology & Scientific Computing

Lab Two
Java ME Part One (Form and Text Filed)
Objective:

 To be familiar with Java ME User Interface

 To understand the use Form class on Java ME

 To work with Java ME TextField and their methods

Put Your Hand for Exercise

Task 1: Creating a Mobile project called lab2 using netbeans

Task 2: Create a Form

 Declare a Form variable with in the class


 Create an instance of Form and set the title of the form Properties of Text Field on the
constructor of your class
 Run the application and have a look what you created

Task 3: Create four Text Fields using different properties

 Declare four TextField variable with in the class


 Create an instance of these text fields with in the constructor of the class, the variables
have the following properties

Variable Label Name Default Text Max Num of Char Constraint


Text1 Name “” 10 Any
Text2 Phone “” 10 Phone Number
Text3 User ID “” 5 Numeric
Text4 Password “” 10 Password
Mobile Programming Laboratory Manual 2 Addis Ababa University, Institute of Technology,
February 2015, - Prepared by Eyob Gebretisnae. Centre of Information Technology & Scientific Computing

 Run the application and why don’t you see the text fields? Just continue to the next Task

Task 4: Append or add four of the Text Fields to the Form you created, using the following
syntax in startApp() method.

form.append(txt1);

 Run the application and understand the User Interface

Exercise: Test the Text Fields

 Write any text in the numeric text field


 Write any text in the password field
 Write more than the character size set in the text field

You might also like