09 display
TRANSCRIPT
![Page 2: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/2.jpg)
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
![Page 3: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/3.jpg)
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.
![Page 4: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/4.jpg)
public class HelloWorld extends MIDlet {
private Display display;
public HelloWorld() {
super();
display = Display.getDisplay(this);
}
…
![Page 5: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/5.jpg)
Display API
![Page 6: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/6.jpg)
Example MIDlet : TestDisplay.java
![Page 7: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/7.jpg)
Displayable
![Page 8: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/8.jpg)
The Rules
• There is only one Display object per
MIDlet.
• Display object can show any number of
Displayable objects.
![Page 9: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/9.jpg)
There are two class that extends Displayable. Those are
Canvas and Screen classes.
![Page 10: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/10.jpg)
Creating Displayable Class
1. Extends Canvas class directly.
2. Use subclasses of Screen.
3. Extends from subclasses of Screen.
![Page 11: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/11.jpg)
Extends Canvas Class Directly
public class MyOwnScreen extends Canvas
{
Drawing something…
}
![Page 12: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/12.jpg)
Use Subclasses of Screen
TextBox t = new TextBox(
"Hello World MIDlet",
"Hello Small World", 256, 0);
...
display.setCurrent(t);
![Page 13: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/13.jpg)
Extends From Subclasses of Screen
public class MyForm extends Form { }
![Page 14: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/14.jpg)
Displayable API
Example MIDlet : TestDisplayable.java
![Page 15: 09 Display](https://reader033.vdocuments.mx/reader033/viewer/2022060117/5586d871d8b42a524a8b46df/html5/thumbnails/15.jpg)
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.