📄 eventhandler.java
字号:
/* * @(#)EventHandler.java 1.19 01/08/16 * 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.lcdui.Command;/** * The Event Handler interface. The constant values constitute the * protocol between the runtime and the Event Delivery system. * The protocol typically consists of a "Major ID," followed optionally * by a "Minor ID" and other data. */public interface EventHandler { /** * Major ID for an internal event signifying that the * request was made to stop the VM. */ static final int STOP_EVENT = -1; /** * Major ID for an event on a key. */ static final int KEY_EVENT = 1; /** * Major ID for a pointer event. */ static final int PEN_EVENT = 2; /** * Major ID for an Abstract Command. */ static final int COMMAND_EVENT = 3; /** * Major ID for an internal Timer event. These are not the same as * the service provided in java.util; they are private sequencing * events used internally by the system. */ static final int TIMER_EVENT = 4; /** * Minor ID indicating a press, either on a key or a pointer. */ static final int PRESSED = 1; // key, pen /** * Minor ID indicating a release, either of a key or a pointer. */ static final int RELEASED = 2; // key, pen /** * Minor ID indicating a key repeat. */ static final int REPEATED = 3; // key /** * Minor ID indicating a character typed (internal). */ static final int TYPED = 4; /** * Minor ID indicating a IME string typed (internal). */ static final int IME = 5; /** * Minor ID indicating a pointer drag. */ static final int DRAGGED = 3; // pen /** * Minor ID indicating a timer for purposes of a screen change. */ static final int SCREEN = 1; // timer /** * Minor ID indicating a timer for purposes of a repaint. */ static final int REPAINT = 2; // timer /** * Minor ID indicating a timer for purposes of a call serially. */ static final int CALLED_SERIALLY = 3; // timer /** * Minor ID indicating that command event requires posting a menu. */ static final int MENU_REQUESTED = -1; /** * Minor ID indicating that command event is dismissing a menu. */ static final int MENU_DISMISSED = -2; /** * The value returned from getSystemKey if the keyCode is the POWER key. */ static final int SYSTEM_KEY_POWER = 1; /** * The value returned from getSystemKey if the keyCode is SEND. */ static final int SYSTEM_KEY_SEND = 2; /** * The value returned from getSystemKey if the keyCode is END. */ static final int SYSTEM_KEY_END = 3; /** * The value returned from getSystemKey if the keyCode is CLEAR. */ static final int SYSTEM_KEY_CLEAR = 4; /** * Schedule a private timer of the given type (SCREEN or REPAINT) * to be triggered milliseconds in the future. * * @param type The type of Timer to schedule * @param milliseconds The delay of the Timer */ void scheduleTimer(int type, int milliseconds); /** * Get the system-specific key code corresponding to the given gameAction. * @param gameAction A game action * @return int The keyCode associated with that action */ int getKeyCode(int gameAction); /** * Get the abstract gameAction corresponding to the given keyCode. * @param keyCode A system-specific keyCode * @return int gameAction The abstract game action associated with * the keyCode */ int getGameAction(int keyCode); /** * Get the informative key string corresponding to the given keyCode. * @param keyCode A system-specific keyCode * @return String a string name for the key, or null if no name is available */ String getKeyName(int keyCode); /** * Get the abstract system key that corresponds to keyCode. * @param keyCode A system-specific keyCode * @return int 0 The SYSTEM_KEY_ constant for this keyCode, or 0 if none */ int getSystemKey(int keyCode); /** * Set the current set of active Abstract Commands. * @param commands The list of Commands that should be active * @param numCommands The number of commands in the list */ void updateCommandSet(Command[] commands, int numCommands); /** * If shouldReceiveEvents == true, make d the object that * will receive events. If shouldReceiveEvents == false and the * current recipient is d, clear the event recipient. * * @param d The DisplayAccess object to receive events in the future. * @param shouldReceiveEvents A flag indicating this handler should * receive events */ void setEventRecipient(DisplayAccess d, boolean shouldReceiveEvents); /** * Returns true if the current thread is the EventHandler's dispatch thread. * @return boolean True if the current thread is this EventHandler's * dispatch thread */ boolean isDispatchThread(); /** * Called to force the event handler to clear whatever system screen * has interrupted the current Displayable and allow the foreground * Display to resume painting. */ void clearSystemScreen();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -