session5 j2me high level user interface(hlui) part1

19
Outline-session 5 (07-April- 2009) >> High-Level User Interface: Part I -Introduction -Screen - Form -Item -DateField -Gauge -StringItem -TextField -Choice and ChoiceGroup -Image and Image Item

Upload: muthusvm

Post on 15-Jan-2015

1.930 views

Category:

Documents


0 download

DESCRIPTION

Session5 J2ME High Level User Interface(HLUI) part1

TRANSCRIPT

Page 1: Session5 J2ME High Level User Interface(HLUI) part1

Outline-session 5 (07-April-2009)

>> High-Level User Interface: Part I-Introduction-Screen- Form-Item-DateField-Gauge-StringItem-TextField-Choice and ChoiceGroup-Image and Image Item

Page 2: Session5 J2ME High Level User Interface(HLUI) part1

Introduction

>>MIDP 2.0 UI interface class in two packages.-- javax.microedition.lcdui--javax.microedition.lcdui.game

>> lcdui stands for lliquid crystal display user interface

>>javax.microedition.lcdui package can be divided into two logical groups: -- high-level group--low-level groups

Page 3: Session5 J2ME High Level User Interface(HLUI) part1

Introduction>>High level group

--high-level group are perfect for development of MIDlets that target the maximum number of devices-- These classes do not provide exact control over their display-- These classes are heavily abstracted to provide minimal control over their look and feel so it can change display according to device configuration.

Page 4: Session5 J2ME High Level User Interface(HLUI) part1

Introduction

>> Low Level group-- These are perfect for MIDlets where precise control over the location and display of the UI elements is important and required-- more Controls comes less portability-- Application not deployable on certain device because they require precise control over the way they look and feel-- There are only two class in this group

Page 5: Session5 J2ME High Level User Interface(HLUI) part1

Introduction

>>what ,why is Displayable and Display ?-- A Displayable class is a UI element that can be shown on the device's screen.-- A Display class abstracts the display functions of an actual device's screen and makes them available to you.--Display provides methods to gain information about the screen and to show or change the current UI element that you want displayed-- MIDlet shows a Displayable UI element on a Display using the setCurrent(Displayable element) method of the Display class. -- The Display can have only one Displayable element at one time.-- The current element that is being displayed can be accessed using the method getCurrent(), which returns an instance of a Displayable element.

Page 6: Session5 J2ME High Level User Interface(HLUI) part1

Class Hierarchy

Page 7: Session5 J2ME High Level User Interface(HLUI) part1

Screen>> Screen Class

-- Screen is a parent class for components that have an actual look and feel on the display.

• Screen API: Screen Class: javax.microedition.lcdui.Screen

Page 8: Session5 J2ME High Level User Interface(HLUI) part1

Form

>> Limitation of the display on mobile Device-- Overlapping windows, toolbars and cascading menus are nowhere to be found-- A Form gives you the option to show multiple components on the display.-- Form as a container that can hold any number of components-- Components are sub class of Item.-- A Form has methods to append, insert, replace and delete components.-- when append a component with form ,append method will return a index value(index value is start from 0).This value is used for identifying position of the form.-- another method (size) will return the number of component in a form.

Page 9: Session5 J2ME High Level User Interface(HLUI) part1

Form API

Page 10: Session5 J2ME High Level User Interface(HLUI) part1

Item

>> Item -- An Item is a component that can be added to a Form. ChoiceGroup,

DateField, Gauge,ImageItem, StringItem and TextField are all subclasses of Item.

-- Working along with an Item is the class ItemStateListener.-- ItemStateListaner will send message when an event occur.-- The recipient of this message is the method itemStateChanged()--- Example FormJuggle.java

Page 11: Session5 J2ME High Level User Interface(HLUI) part1

DateField>> Using the DateField component, you manipulate a Date object (as defined

in java. util. Date) using the keys and/or soft buttons on a mobile device.>> When creating a DateField object you specify whether the user can edit

the date, the time, or both—see the mode constants declared>> Example snoozing.java

Page 12: Session5 J2ME High Level User Interface(HLUI) part1

DateField API

Page 13: Session5 J2ME High Level User Interface(HLUI) part1

Gauge >> It’s a form of measure the progress.>> A Gauge has two means of being updated.>> The first is referred to as interactive mode, where the usermakes the changes.>> The second, for lack of a better term, is a non-interactive

mode. It is up to you as the developer to change the values .>> Example: InteractiveGauge.java, Non-interactive Gauge.java

Page 14: Session5 J2ME High Level User Interface(HLUI) part1

Gauge API

Page 15: Session5 J2ME High Level User Interface(HLUI) part1

StringItem

>> A StringItem displays a static label and text message>> user cannot edit either the label or the text>> StringItem does not recognize events>> once you create a StringItem, you can get/set the text

message with methods inside the StringItem class>> get/set the label, you can do so using methods inheritedfrom the Item class.Sample: ChangeLabelText.java, StringItemAlternative.java

Page 16: Session5 J2ME High Level User Interface(HLUI) part1

StringItem

Page 17: Session5 J2ME High Level User Interface(HLUI) part1

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.

Page 18: Session5 J2ME High Level User Interface(HLUI) part1

TextField

Page 19: Session5 J2ME High Level User Interface(HLUI) part1

TextField API