DisplayEventHandlerFactory.javaAPI DocphoneME MR2 API (J2ME)3030Wed May 02 18:00:24 BST 2007com.sun.midp.lcdui


public class DisplayEventHandlerFactory extends Object
This class works around the fact that public classes can not be added to a javax package by an implementation.

Fields Summary
private static DisplayEventHandler
The real implementation of the display event handler.
Constructors Summary
Methods Summary
public static voidSetDisplayEventHandlerImpl(DisplayEventHandler dm)
Set the implementation of the display manager, if one is not already set.

This implementation class will be in the as the Display class for security. But needs placed here to be visible to com.sun.midp classes.

dm reference to the system display manager

        if (managerImpl != null) {

        managerImpl = dm;
public static DisplayEventHandlergetDisplayEventHandler( token)
Return a reference to the singleton display manager object.

token security token with the MIDP permission "allowed"
display manager reference.


        if (managerImpl != null) {
            return managerImpl;

         * The display manager implementation is a private class of Display
         * and is create in the class init of Display, we need to call a
         * static method of display to get the class init to run, because
         * some classes need to get the display manager to create a display
        try {
            // this will yield a null pointer exception on purpose
        } catch (NullPointerException npe) {
            // this is normal for this case, do nothing

        return managerImpl;