8.3. Display

The Display class is the central controller of the display of a MIDP application. An application gets a Display instance by calling the static method getDisplay and by passing the MIDlet instance to the method:

Display midletDisplay = Display.getDisplay(myMIDlet);

When the Display instance is obtained, the application can change the Displayables presented on the device using the methods of the Display class. There are three methods in class Display that allow the application to set the current Displayable instance presented on the device display. The most commonly used method is:

public void setCurrent(Displayable nextDisplayable)

The two other methods are provided for more specialized use:

 public void setCurrent(Alert alert, ...

Get Programming Wireless Devices with the Java™ 2 Platform, Micro Edition, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.