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.

09 Display

666 views

Published on

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

  • Be the first to like this

09 Display

  1. 1. Display Cornelius Koo – 2005 cornelius.mellino@gmail.com
  2. 2. What is Display• The Display object working just like a manager of the display controlling what is shown on the device and when.• javax.microedition.lcdui.Display
  3. 3. How to Get• Display object is made available to MIDlet through a call to static method declared inside the Display class.• The reference is often held for a lifetime of MIDlet.
  4. 4. public class HelloWorld extends MIDlet { private Display display; public HelloWorld() { super(); display = Display.getDisplay(this); }…
  5. 5. Display API
  6. 6. Example MIDlet : TestDisplay.java
  7. 7. Displayable
  8. 8. The Rules• There is only one Display object per MIDlet.• Display object can show any number of Displayable objects.
  9. 9. There are two class that extends Displayable. Those areCanvas and Screen classes.
  10. 10. Creating Displayable Class1. Extends Canvas class directly.2. Use subclasses of Screen.3. Extends from subclasses of Screen.
  11. 11. Extends Canvas Class Directlypublic class MyOwnScreen extends Canvas{ Drawing something…}
  12. 12. Use Subclasses of ScreenTextBox t = new TextBox( "Hello World MIDlet", "Hello Small World", 256, 0);...display.setCurrent(t);
  13. 13. Extends From Subclasses of Screenpublic class MyForm extends Form { }
  14. 14. Displayable APIExample MIDlet : TestDisplayable.java
  15. 15. Reference• Core J2ME Technology and MIDP. John W. Muchow. Prentice Hall PTR, 2002.• Enterprise J2ME: Developing Mobile Java Applications. Michael Juntao Yuan. Prentice Hall PTR, 2003.• J2ME in A Nutshell. Kim Topley. Oreilly, 2002.

×