09 Display

613 views

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
613
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

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.

×