Session6 J2ME High Level User Interface(HLUI) part1

  • 771 views
Uploaded on

Sesssion6 HLUI Part1

Sesssion6 HLUI Part1

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • free download the updated file from here:-http://gg.gg/yi7pn
    Are you sure you want to
    Your message goes here
    Be the first to like this
No Downloads

Views

Total Views
771
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
25
Comments
1
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Outline-session 6 (09-April-2009)
    • >> High-Level User Interface: Part I
    • -TextField
    • -Choice and ChoiceGroup
    • -Image and Image Item
  • 2. TextField
    • >> create a TextField you can specify an input constraint.
    • >> A constraint provides restrictions on the data that a user may enter
    • >> There are four constraints to support the following specific types of input
    • --email addresses,
    • -- URLs
    • -- numeric values and
    • -- phone numbers
    • >> In addition to constraints, when you create a TextField you specify how many characters you anticipate you will need.
  • 3. TextField
  • 4. TextField
  • 5. Constraint Value
    • >> values assigned to each constraint
    • >> Its not possible to combine constraint(Password is a special case)
    • >> let's combine EMAILADDR and NUMERIC.
    • TextField.EMAILADDR 00000000 00000000 0000000 1
    • TextField.NUMERIC 00000000 00000000 000000 10
    • ----------------------------
    • logical OR 00000000 00000000 000000 11
    • 000000 11 is the value for PHONENUMBER
  • 6. Constraint Value
    • >> Now, let's combine, PASSWORD with EMAILADDR and see what we get
    • TextField.EMAILADDR 00000000 00000000 0000000 1
    • TextField.PASSWORD 00000001 00000000 00000000
    • ----------------------------
    • logical OR 0000000 1 00000000 00000001
    • >> first (right-most) 16 bits are reserved for constraints
    • >> PASSWORD is outside the range of these values, we don't have a collision with another constraint
    • >> PASSWORD is a modifier that is to be used along with other constraints
    • >> you cannot combine constraints.
  • 7. Constraint Value
    • >> how the constraint mask works
    • >> mask was created to work in conjunction with the method getConstraints()
    • >> reason for the mask is to remove the PASSWORD modifier
    • >> When you need to know the value of the constraint for a TextField, you call this method and perform a logical AND operation as follows
    • >> TextField.getConstraints() & TextField.CONSTRAINT_MASK
    • >>TextField tfPwd = new TextField("Password:", "", 10,TextField.ANY | TextField.PASSWORD);
    • TextField.ANY 00000000 00000000 00000000
    • TextField.PASSWORD 0000000 1 00000000 00000000
    • --------------------------
    • constraint value 0000000 1 00000000 00000000
    • >>tfPwd.getConstraints() 0000000 1 00000000 00000000
    • >>to get the value we are looking for, we need to mask off the modifier:
    • tfPwd.getConstraints() & TextField.CONSTRAINT_MASK
  • 8. Constraint Value
    • >> how the constraint mask works
    • which looks as follows:
    • tfPwd.getConstraints() 000000 1 00000000 00000000
    • TextField.CONSTRAINT_MASK 00000000 11111111 11111111
    • ----------------------------
    • logical AND 00000000 00000000 00000000
    • >>if ((tfPwd.getConstraints() & TextField.PASSWORD) != 0)
    • System.out.println("Password modifier applied");
  • 9.