J2ME - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

J2ME

Description:

Adds a listener object to the Widget's list. The widget ... Widget (the Form) The Form's addCommandListener() adds the Listener object to the button's list. ... – PowerPoint PPT presentation

Number of Views:256
Avg rating:3.0/5.0
Slides: 24
Provided by: chris520
Category:
Tags: j2me | addons | widget

less

Transcript and Presenter's Notes

Title: J2ME


1
J2ME GUI Design
  • Revision of
  • The Java Event Handling Model
  • If you understand this, you will be able to
  • Explain the development of J2ME from J2SE
  • List problems of GUI design for mobile devices
  • Describe J2ME GUI components
  • Explain GUI design in limited devices
  • What is an CommandActionr?

2
Java 2 Mobile Edition
  • Java 2 Standard Edition (J2SE)
  • Sophisticated, but resource-intensive
    environment.
  • Various add-ons e.g. secure sockets API
  • Virtual Machine supports run-time checking
    optimisations
  • (e.g. Just-In-Time compiler)
  • Java 2 Enterprise Edition (J2EE)
  • Support for multi-tiered systems
  • Java 2 Mobile Edition (J2ME)
  • Platform for small devices
  • Handles a wide range of mobile device
    capabilities
  • Using basic configurations device-specific
    profiles
  • J2ME software capabilities depend on device
    facilities
  • J2SE provides same capabilities on all PCs

3
Configurations Profiles
  • Configurations
  • A defined environment for devices meeting
    criteria for
  • Types (ROM/RAM) amount of memory
  • Type and speed of processor
  • Type of network connection
  • Provides Virtual Machine core classes.
  • Defined by the omitted features of J2SE
  • Profiles
  • Extra classes specific to a device type
  • Extend configuration

4
Defining Configurations
  • Base on J2SE
  • To maximise compatibility ease of learning
  • Use existing J2SE classes packages
  • (Where possible)
  • Do not change J2SE classes packages
  • Can omit packages
  • Can omit deprecated features
  • Features left in for backward compatibility
  • Likely to be removed in next release

5
Connected Limited Device Configuration
  • Mobile phones, PDAs (500KB memory)
  • Requirements
  • 160KB persistent memory (ROM, flash memory)
  • 32KB volatile memory
  • 16 or 32 bit processor
  • Connection to a network
  • Does not require a display, keyboard or mouse

6
CLDC Features
  • CLDC Virtual Machine (was called KVM)
  • Small memory requirement
  • Special garbage collector
  • No interfacing to native code (for security)
  • Reduced support for Threads, Exceptions
  • Pre-verification less run-time checking
  • Excludes deprecated features from J2SE
  • Special IO package
  • Generic Connection Framework

7
Connected Device Configuration
  • CDC
  • Approx. 2MB RAM, 2.5MB ROM
  • High-end PDAs, set-top boxes
  • Much closer to J2SE
  • Profiles
  • Foundation Profile Non-GUI programming
  • Personal Basis Profile FP lightweight AWT
  • Personal Profile PBP AWT Applet

8
Mobile Information Device Profile
  • Requirements
  • CLDC minimum
  • Extra 256KB non-volatile memory for MIDP runtime
  • 128KB heap for dynamic objects
  • 8KB non-volatile memory for persistent program
    data
  • (must try to maintain over battery changing)
  • Screen 96 pixels wide by 54 pixels high
  • At least 2 colours
  • 1 or 2 handed keyboard or touch screen
  • Ability to play sound tones
  • Network access (2-way wireless, may be
    intermittent)
  • OS to provide access to storage user input

9
Mobile Information Devices
10
MIDP UI
TextField
StringItem
DateField
Gauge
ChoiceGroup
ChoiceGroup
Command Selection
Command
Arrow
Select button
11
Other Widgets
  • Ticker
  • Scrolling text
  • TextBox
  • Full-screen text entry
  • ImageItem
  • Image
  • List
  • Full-screen choice
  • Alert
  • Dialog box
  • Canvas
  • Drawing surface

12
MIDlet
  • An application to run on a mobile phone
  • Runs on a cut-down Virtual Machine
  • Key methods to be implemented
  • startApp
  • pauseApp
  • destroyApp
  • startApp called initially and after pause

13
MIDlet Framework
MIDlet Class
startAppltemptygt
notifyDestoyed()
Pre-implemented methods
pauseAppltemptygt
getAppProperty()
Descendent of MIDlet
destroyAppltgt
Implemented methods
startApp ltusefulgt
pauseApp ltusefulgt
destroyAppltgt
Mobile Information Device VM
14
MIDlet Methods
15
Event Handling
  • The Listener Object
  • Has the event handler routine as one of its
    methods
  • The method name and parameters are defined by an
    interface that the object implements.
  • The Application
  • Adds a listener object to the Widgets list
  • The widget
  • When the event occurs, runs through its list,
    calling the event handler method for each object.

16
Diagram of Java Event Model
Event
List of Listeners
Component
Event information
Part of main program interested in events
Listener
Part of main program interested in events
Event-specific method
17
Commands Creation Listening
  • public class GUIMIDlet extends MIDlet implements
    CommandListener
  •  
  • private Form theForm new Form("Personal
    Information")
  •  
  • Command exCo new Command("Exit", Command.EXIT,
    0)
  •  
  • protected void startApp()
  • theForm.setCommandListener(this) // register
    listener
  • theForm.addCommand(exCo) // link command
    form

18
Key Objects
  • Listener
  • This is the CommandListener.
  • The event handler routine is called
    commandAction.
  • Widget (the Form)
  • The Forms addCommandListener() adds the Listener
    object to the buttons list.
  • When the command is selected, the form calls the
    commandAction() method on our Listener object.

19
Commands Event Handler
  • public void commandAction (Command p1,
    Displayable p2)
  • if (p1 exitCommand)
  • destroyApp(true)
  • notifyDestroyed()
  •  

20
UI Guidelines for All Software
  • The Ideal
  • The UI is designed to match
  • The task to be performed
  • The capabilities of the users
  • The UI should be natural obvious
  • Learnable
  • Effective
  • Easy to recover from errors

21
Problems of Mobile Devices
  • Low resolution
  • Small Screen
  • Few keys
  • No pointing device
  • Response time
  • Low processing power 

22
What are the implications?
  • Simplicity
  • Minimize input
  • Minimize possibilities for error
  • e.g. dd/mm/yy

23
Summary
  • J2ME
  • Cut-down Java
  • Configurations profiles
  • MIDlet
  • A class with specific methods called by phone
  • startApp()
  • pauseApp()
  • destroyApp()
Write a Comment
User Comments (0)
About PowerShow.com