Session8 J2ME Low Level User Interface

  • 2,685 views
Uploaded on

Session8 J2ME Low Level User Interface

Session8 J2ME Low Level User Interface

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,685
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
88
Comments
0
Likes
1

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 8 (09-April-2009)
    • >> Low-Level User Interface
    • -Introduction
    • -Canvas
    • -Graphics
  • 2. Introduction
    • >>Two key classes make up the low-level API, Canvas and Graphics.
    • Canvas :
    • >>it has a specific height and width and is drawn onto to create what the end user will see.
    • >> Whatever is drawn becomes visible on the display.
    • >>The canvas class also provides methods for low-level event handling
    • Graphics:
    • >>We draw onto a canvas with a Graphics object.
    • >>This class has methods for drawing lines, arcs, rectangles and text.
    • >>This class also includes methods to specify color as well as font preferences.
  • 3. Canvas
    • >> Canvas is a subclass of Displayable
    • Creating Canvas:
    • >> create a subclass of Canvas, and ask that object be set as the current Displayable.
  • 4. Canvas
    • >> Coordinate System
    • --The origin for drawing begins in the upper left corner of the display, location 0,0
    • --x values increase heading to the right, y values increase heading down
    • -- When drawing a line or shape (arc, rectangle, etc.), the thickness (known as the pen) is always 1 pixel wide
    • -- if you request to start a line at 1,1
    • --How many pixels will be "filled" for the entire line segment 1,1 to 3,1?
  • 5. Canvas
    • >>Canvas Width and Height
    • >> Painting on a Canvas:
    • -What differs between a Canvas and the other Displayable objects (Form, TextBox, List and Alert) is where the drawing of the component takes place and who is responsible for the drawing.
  • 6. Canvas
    • >>Canvas Paint Methods:
    • .
  • 7. Canvas
    • >> Communication with Application Manager :
    • -- When the application manager is about to make a Canvas visible on the display, it will call the method showNotify().
    • -- When the Canvas has been removed from the display, the method hideNotify() is called
    • .
  • 8. Canvas
    • >> Communication with Application Manager :
    • -- When the application manager is about to make a Canvas visible on the display, it will call the method showNotify().
    • -- When the Canvas has been removed from the display, the method hideNotify() is called
    • .
  • 9. Canvas
    • >> Event Handling :
    • --The low-level interface, consisting of key codes, game actions and pointer events.
    • Commands:
    • • addCommand(Command)
    • • isShown()
    • • removeCommand(Command)
    • • setCommandListener(CommandListener)
    • .
  • 10. Canvas
    • >> Key Codes :
    • --Key codes are numeric values that map directly to specific keys on a mobile device.
    • --These codes correspond to the ITU-T keypad (0–9, *, #) the standard telephone keypad
    • .
  • 11. Canvas
    • >> Key Codes :
    • .
  • 12. Canvas
    • >> Game Actions:
    • --MIDP defines a set of constants, referred to as game actions, to facilitate event handling for game related events.
    • --You are assured that each game action will be assigned a key code by the implementation
    • Sample:GameAction.java
    • .
  • 13. Canvas
  • 14. Canvas
    • >> pointer events:
    • -- The MID Profile includes a set of methods to interact with pointer devices such as a mouse or touch screen.
    • .