Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

J2ME GUI Programming


Published on

Published in: Technology, Business
  • Be the first to comment

J2ME GUI Programming

  1. 1. J2ME : GUI Programming Rohan Chandane These notes are created by me, Rohan Chandane as learning material while pursuing MSc(CA) from SICSR 2005-2007 (CC)
  2. 2. Use of Profile For GUI Programming we can use different Profiles Here, we will see Mobile Information Device Profile (MIDP)
  3. 3. 3 things in MIDP MIDlets High-Level API Low-Level API
  4. 4. MIDlets All application using MIDP, derived from package javax.microedition.midlet
  5. 5. Continued… A MIDlet can exist in four different states Loaded MIDlet is loaded into the device The constructor is called, This is called the loaded state Active After loaded state of MIDlet, it is in the active state Until its paused or destroyed
  6. 6. Continued… Paused Applications should stop animations Release resources that are not needed This state avoids Resource conflicts with the application running in the foreground Unnecessary battery consumption Destroyed MIDlet gets Terminated
  7. 7. MIDlet life cycle
  8. 8. Continued… startApp() The program manager starts the application by calling the startApp() method, then MIDlet get loaded pauseApp() Pauses the MIDlet
  9. 9. Continued… destroyApp() provides an unconditional parameter If false - MIDlet is allowed to refuse its termination & Throws MIDletStateChangeException resumeRequest() - If a MIDlet need to resume activity, this informs application manager
  10. 10. Continued… notifyPaused() - If a MIDlet need to go to the paused state, this informs application manager notifyDestroyed() – In order to terminate, this informs application manager
  11. 11. User Interface Architecture MIDP 2.0 has two UI Package javax.microedition.lcdui lcdui - Liquid Crystal Display User Interface For development of a wireless game UI
  12. 12. Continued… javax.microedition.lcdui divided into two logical groups High Level Group Low Level Group
  13. 13. Continued… High Level Group Classes provided are Perfect for development of MIDlets that target the maximum number of devices Heavily abstracted to provide minimal control over their look and feel Classes do not provide exact control over their display
  14. 14. Continued… High Level MIDP 2.0 UI classes
  15. 15. Continued… Low Level Group Classes provided are Perfect for MIDlets where we want precise control over the location and display of the UI elements If more control there is comes less portability It may not be deployable on certain devices
  16. 16. Continued… Low Level MIDP 2.0 UI classes And GameCanvas
  17. 17. Displayable Interface To show a UI element on a device screen Displayable Interface must implemented in Midlet Whether high or low level APIs, it have to implement Displayable Interface The Graphics class does not implement this interface Because it deals with low-level 2D graphics that directly manipulate the device's screen
  18. 18. Continued… Canvas and Screen implement the Displayable interface
  19. 19. High-Level API Event handling Two Categories of Events Command events Command events are triggered by key presses on the device Item events Item events are the result of visual components changing on the display