gamemap.java

来自「用于移动设备上的java虚拟机源代码」· Java 代码 · 共 62 行

JAVA
62
字号
/* * @(#)GameMap.java	1.9 02/10/11 @(#) * * Copyright (c) 2000-2002 Sun Microsystems, Inc.  All rights reserved. * PROPRIETARY/CONFIDENTIAL * Use is subject to license terms. */package com.sun.midp.lcdui;import javax.microedition.lcdui.Displayable;/** * A class that maps between DisplayAccess objects and Displayable, GameCanvas. * In future versions of the MIDP spec, GameCanvas may have been * moved to lcdui package, in which case this class isn't needed. */public class GameMap {    /**     * The Displayable associated with the DisplayAccess     */    static private Displayable displayable;    /**     * The DisplayAccess associated with the GameCanvas     */    static private DisplayAccess displayAccess;    static final private Object lock = new Object();    /**     * Associate the given Displayable and DisplayAccess.  This is a     * one-way association.     *     * @param c The GameCanvas to store     * @param d The DisplayAccess associated with the GameCanvas     */    public static void register(Displayable c, DisplayAccess d) {        synchronized (lock) {	    displayable = c;	    displayAccess = d;	}    }    /**     * Get the DisplayAccess object for this Displayable.     * @param c The Displayable to get the DisplayAccess for     * @return DisplayAccess The DisplayAccess associated with the MIDlet     */    public static DisplayAccess get(Displayable c) {        synchronized (lock) {  	    if (c == displayable) {                return displayAccess;  	    } else {                return null;	    }        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?