📄 midletmap.java
字号:
/* * @(#)MIDLetMap.java 1.9 01/08/12 * * Copyright (c) 2000-2001 Sun Microsystems, Inc., 901 San Antonio Road, * Palo Alto, CA 94303, U.S.A. All Rights Reserved. * * Sun Microsystems, Inc. has intellectual property rights relating * to the technology embodied in this software. In particular, and * without limitation, these intellectual property rights may include * one or more U.S. patents, foreign patents, or pending * applications. Sun, Sun Microsystems, the Sun logo, Java, KJava, * and all Sun-based and Java-based marks are trademarks or * registered trademarks of Sun Microsystems, Inc. in the United * States and other countries. * * This software is distributed under licenses restricting its use, * copying, distribution, and decompilation. No part of this * software may be reproduced in any form by any means without prior * written authorization of Sun and its licensors, if any. * * FEDERAL ACQUISITIONS: Commercial Software -- Government Users * Subject to Standard License Terms and Conditions */package com.sun.midp.lcdui;import javax.microedition.midlet.MIDlet;import java.util.Hashtable;/** * A class that maps between DisplayAccess objects and MIDlets. * In future versions of the MIDP spec, MIDlet may have been * removed, in which case this will either map directly between * DisplayAccess and MIDLet, or it may be that this class isn't needed. */public class MIDLetMap { /** Table to store the midlet map in */ static private Hashtable table = new Hashtable(); /** * Associate the given MIDlet and DisplayAccess. This is a * two-way association, i.e. you can look up either one wrt the other. * * @param m The Midlet to store * @param d The DisplayAccess associated with the MIDlet */ public static void put(MIDlet m, DisplayAccess d) { table.put(m, d); table.put(d, m); } /** * Remove any references to the given MIDlet from the map so it can be * garbage collected. * * @param m The MIDlet to remove from the map */ public static void remove(MIDlet m) { DisplayAccess d; d = get(m); table.remove(m); if (d == null) { return; } table.remove(d); } /** * Get the DisplayAccess object for this MIDlet. * * @param m The MIDlet to get the DisplayAccess for * @return DisplayAccess The DisplayAccess associated with the MIDlet */ public static DisplayAccess get(MIDlet m) { return (DisplayAccess) table.get(m); } /** * Get the MIDlet for this DisplayAcess object. * * @param d The DisplayAccess to get the MIDlet for * @return MIDlet The MIDlet associated with this DisplayAccess */ public static MIDlet get(DisplayAccess d) { return (MIDlet) table.get(d); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -