display.jpp
来自「This is a resource based on j2me embedde」· JPP 代码 · 共 1,698 行 · 第 1/5 页
JPP
1,698 行
public static final int COLOR_HIGHLIGHTED_BACKGROUND = 2; /** * A color specifier for use with <code>getColor</code>. * <code>COLOR_HIGHLIGHTED_FOREGROUND</code> identifies the color for text * characters and simple graphics when they are highlighted. * Highlighted * foreground is the color to be used to draw the highlighted text * and graphics against the highlighted background. * The highlighted foreground will always constrast with * the highlighted background. * * <p> * <code>COLOR_HIGHLIGHTED_FOREGROUND</code> has the value <code>3</code>. * * @see #getColor */ public static final int COLOR_HIGHLIGHTED_FOREGROUND = 3; /** * A color specifier for use with <code>getColor</code>. * <code>COLOR_BORDER</code> identifies the color for boxes and borders * when the object is to be drawn in a * non-highlighted state. The border color is intended to be used with * the background color and will contrast with it. * The application should draw its borders using the stroke style returned * by <code>getBorderStyle()</code>. * * <p> <code>COLOR_BORDER</code> has the value <code>4</code>. * * @see #getColor */ public static final int COLOR_BORDER = 4; /** * A color specifier for use with <code>getColor</code>. * <code>COLOR_HIGHLIGHTED_BORDER</code> * identifies the color for boxes and borders when the object is to be * drawn in a highlighted state. The highlighted border color is intended * to be used with the background color (not the highlighted background * color) and will contrast with it. The application should draw its * borders using the stroke style returned <code>by getBorderStyle()</code>. * * <p> <code>COLOR_HIGHLIGHTED_BORDER</code> has the value <code>5</code>. * * @see #getColor */ public static final int COLOR_HIGHLIGHTED_BORDER = 5;/* * ************* protected member variables *//* * ************* package private member variables */ /** Static lock object for LCDUI package. */ static final Object LCDUILock = new Object(); /** Static lock object for making calls into application code. */ static final Object calloutLock = new Object(); /** Primary display width. */ static int WIDTH; /** Primary display height. */ static int HEIGHT; /** Current display width. */ int width; /** Current display height. */ int height; /** * True, if this displays need to draw the trusted icon * in the top status bar. */ static boolean drawSuiteTrustedIcon; /** ID of this Display. */ int displayId; /** Owner of the Display, can be any class. */ Object owner; /** If the current display mode is known. * We don't know it before the lSetFullScreen is * called for the first time and after we being * in the background. */ boolean screenModeKnown = false; /** If the current display mode is known. * Set to false after display changing */ boolean isRotatedKnown = false; /** * Current display orientation */ boolean wantRotation; /** The last mode value passed to lSetFullScreen method. */ boolean lastFullScnMode; /** Display access helper class. */ DisplayAccessImpl accessor; /** Display device class. */ DisplayDevice displayDevice; /** Display event consumer helper class. */ DisplayEventConsumerImpl consumer; /** Foreground event consumer helper class. */ ForegroundEventConsumerImpl foregroundConsumer; // #ifdef ENABLE_CHAMELEON /** Chameleon Display tunnel helper class */ ChamDisplayTunnel cham_tunnel; /** Chameleon loop variable for holding the refresh region */ int[] region; /** The TextInputMediator which handles translating key presses */ TextInputSession inputSession; /** The PopupLayer that represents open state of predicitve text input popup. */ PTILayer pt_popup; /** The PopupLayer that represents java virtual keyboard */ VirtualKeyboardLayer keyboardLayer; // #endif ENABLE_CHAMELEON /** Producer of midlet lifecycle events. */ ForegroundController foregroundController; /** Display event handler with private methods. */ static DisplayEventHandlerImpl displayEventHandlerImpl; /** * <code>true</code>, if the <code>Display</code> is the foreground * object. */ boolean hasForeground; // = false; /** * <code>true</code>, if the <code>DisplayDevice</code> was disabled * while the <code>Display<code> object has been in foreground state */ boolean disabledForeground; // = false;/* * ************* private member variables */ /** * Inner class to request security token from SecurityInitializer. * SecurityInitializer should be able to check this inner class name. */ static private class SecurityTrusted implements ImplicitlyTrustedClass {} /** Security token to allow access to implementation APIs */ private static SecurityToken classSecurityToken = SecurityInitializer.requestToken(new SecurityTrusted()); /** Device Access manager. */ private static DisplayDeviceAccess deviceAccess; /** Cached reference to the ForegroundController. */ private static ForegroundController defaultForegroundController; /** Producer for Display events. */ private static DisplayEventProducer displayEventProducer; /** Producer for Repaint events. */ private static RepaintEventProducer repaintEventProducer; /** Cached reference to Active Displays Container. */ private static DisplayContainer displayContainer; /** Cached reference to Display Devices Container. */ private static DisplayDeviceContainer displayDeviceContainer; /** Device <code>Graphics</code> associated with this Display. */ private Graphics screenGraphics; /** wantsForeground state when the MIDlet wants to be in the background. */ private static final int WANTS_BACKGROUND = 0; /** wantsForeground state when the MIDlet wants to be in the foreground. */ private static final int WANTS_FOREGROUND = 1; /** * wantsForeground state when the MIDlet wants to be in the foreground * to display an alert. */ private static final int WANTS_FOREGROUND_FOR_ALERT = 2; /** * Since the current Displayable can't be set to null we use a * separate state to keep track of if the MIDlet wants the foreground or * not. */ private int wantsForeground = WANTS_BACKGROUND; /** * Reference to the initial displayable of this display. Whenever the * current displayable is set to this displayable, a call * to getCurrent() should return null. */ private DisplayableLF initialDisplayable; /** The actual current DisplayableLF instance.*/ private DisplayableLF current; /** * The DisplayableLF that is in the process of becoming current. This is * non-null only in the midst of the actual screen change. It is null at * all other times. This is used to modify the behavior getCurrent(). The * value of 'current' is null momentarily during the screen change, and * during these times getCurrent() returns the value of transitionCurrent * instead of null. */ private DisplayableLF transitionCurrent; /** * Holds a reference to the DisplayableLF most recently requested to * become current, whether through setCurrent() or through the dismissal * of an alert. Note that this variable is not cleared after screen change * processing completes. When the system is quiescent, pendingCurrent will * equal current. When there is a screen-change event in the queue, * pendingCurrent will generally differ from current. */ private DisplayableLF pendingCurrent; // #ifdef ENABLE_CHAMELEON /** Chameleon rendering window */ private MIDPWindow window; /** Chameleon graphics queue */ private CGraphicsQ graphicsQ; // #endif ENABLE_CHAMELEON /** Accessor to extended Image API needed for Chameleon and GameCanvas */ private static GraphicsAccessImpl graphicsAccessor; /** * <code>True</code> if a system screen, like menu, is up. */ private boolean paintSuspended; // = false /** First queue of serialized repaint operations. */ private static java.util.Vector queue1 = new java.util.Vector(); /** Second queue of serialized repaint operations. */ private static java.util.Vector queue2 = new java.util.Vector(); /** Current active queue for serially repainted operations. */ private static java.util.Vector currentQueue = queue1; // #ifdef ENABLE_GCI /** GCIDisplay that incapsulates information about the display device */ private GCIDisplay gciDisplay; /** GCIScreenWidget that represents a device screen */ private static GCIScreenWidget gciScreenWidget; // #endif ENABLE_GCI/* * ************* Static initializer, constructor */ static { // #ifdef ENABLE_GCI java.security.AccessController.doPrivileged( new sun.security.action.LoadLibraryAction("gci")); GCIDisplay gciDisplay = GCIGraphicsEnvironment.getInstance().getDefaultDisplay(); WIDTH = gciDisplay.getWidth(); HEIGHT = gciDisplay.getHeight(); // #endif ENABLE_GCI graphicsAccessor = new GraphicsAccessImpl(); GameMap.registerGraphicsAccess(graphicsAccessor); // #ifdef ENABLE_CHAMELEON SkinLoader.initGraphicsAccess(graphicsAccessor); // IMPL_NOTE: In the MVM mode it's important to do the first // skin resources loading from the AMS isolate, since they // are shared between all working isolates. try { SkinLoader.loadSkin(false); } catch (IOException e) { if (Logging.REPORT_LEVEL <= Logging.CRITICAL) { Logging.report(Logging.CRITICAL, LogChannels.LC_HIGHUI, "IOException while loading skin: " + e.getMessage()); } throw new RuntimeException("IOException while loading skin"); } // #endif ENABLE_CHAMELEON /* Let com.sun.midp classes call in to this class. */ displayEventHandlerImpl = new DisplayEventHandlerImpl(); DisplayEventHandlerFactory.SetDisplayEventHandlerImpl( displayEventHandlerImpl); deviceAccess = new DisplayDeviceAccess(); DisplayStaticAccess displayStaticAccess = new DisplayStaticAccess () { public Display getDisplay(Object owner) { return Display.getDisplay(owner); } public boolean freeDisplay(Object owner) { return Display.freeDisplays(owner); } }; DisplayFactory.setStaticDisplayAccess(classSecurityToken, displayStaticAccess); } /** * Initializes the display for the primary hardware display * * @param theOwner class of the MIDlet that owns this Display */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?