MIDP3.0

javax.microedition.lcdui
Interface DisplayListener


public interface DisplayListener

The DisplayListener interface defines a series of methods that are called in response to Display events. Examples of Display events include the addition of new Displays and changes to the state of an existing Display. A DisplayListener may be added using the Display.addDisplayListener method.

Since:
MIDP 3.0

Method Summary
 void displayAdded(Display d)
          This method is called when a new Display becomes available for the MIDlet.
 void displayStateChanged(Display d, int newState)
          This method is called when the state of a Display changes.
 void hardwareStateChanged(Display d, int newState)
          This method is called when the state of a Display's hardware changes.
 void orientationChanged(Display d, int newOrientation)
          This method is called when a Display's orientation changes.
 void sizeChanged(Display d, int w, int h)
          The implementation calls this method when the dimensions of a Display have been changed, i.e.
 

Method Detail

displayAdded

void displayAdded(Display d)
This method is called when a new Display becomes available for the MIDlet. A new Display is added when the device establishes a connection with new auxiliary display hardware. The hardwareStateChanged method can be used to detect subsequent changes to the state of the Display's hardware.

Parameters:
d - the new Display that was added

displayStateChanged

void displayStateChanged(Display d,
                         int newState)
This method is called when the state of a Display changes.

Parameters:
d - the Display whose state changed
newState - the new state of the Display (STATE_BACKGROUND, STATE_FOREGROUND, or STATE_VISIBLE)

hardwareStateChanged

void hardwareStateChanged(Display d,
                          int newState)
This method is called when the state of a Display's hardware changes.

Parameters:
d - the Display
newState - the new hardware state of the Display ( Display.DISPLAY_HARDWARE_ENABLED, Display.DISPLAY_HARDWARE_DISABLED, or Display.DISPLAY_HARDWARE_ABSENT)

orientationChanged

void orientationChanged(Display d,
                        int newOrientation)
This method is called when a Display's orientation changes. Such a change may be caused by a change to the MIDlet's preferred orientation or by the user via a change to the device's settings. If currently shown on the Display, the Displayable's sizeChanged method may also be called in response to an orientation change.

Parameters:
d - the Display
newOrientation - the new orientation of the Display ( Display.ORIENTATION_PORTRAIT, Display.ORIENTATION_LANDSCAPE, Display.ORIENTATION_PORTRAIT_180, or Display.ORIENTATION_LANDSCAPE_180)

sizeChanged

void sizeChanged(Display d,
                 int w,
                 int h)
The implementation calls this method when the dimensions of a Display have been changed, i.e. as a result of a change in screen orientation or resizing of a virtual display such as a window.

If the size of a Display changes while its contents are visible, sizeChanged will be called. If the size of a Display changes while its contents are not visible, calls to sizeChanged may be deferred. If the size had changed while the Display contents were not visible, sizeChanged will be called at least once at the time the contents of the Display become visible once again.

Parameters:
d - the Display
w - the new width in pixels of the available area
h - the new height in pixels of the available area
Since:
MIDP 3.0

MIDP3.0

Send a comment or suggestionVersion 3.0 of Mobile Information Device Profile Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-2009 Motorola Inc. Portions copyright 1993-2002 Sun Microsystems, Inc. and Motorola, Inc. All Rights Reserved.