FileDocCategorySizeDatePackage
EventHandler.javaAPI DocJ2ME MIDP 2.07340Thu Nov 07 12:02:22 GMT 2002com.sun.midp.lcdui

EventHandler

public interface EventHandler
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.

Fields Summary
static final int
KEY_EVENT
Major ID for an event on a key.
static final int
PEN_EVENT
Major ID for a pointer event.
static final int
COMMAND_EVENT
Major ID for an Abstract Command.
static final int
SYSTEM_EVENT
Major ID for a "system" event. This type of an event is for identifying things like interruptions by the underlying device to stop the VM, pause the current MIDlet, suspend operations, kill the current MIDlet, etc.
static final int
MM_EOM_EVENT
Major ID for an multimedia EOM event. --- by hsy
static final int
PRESSED
Minor ID indicating a press, either on a key or a pointer.
static final int
RELEASED
Minor ID indicating a release, either of a key or a pointer.
static final int
REPEATED
Minor ID indicating a key repeat.
static final int
TYPED
Minor ID indicating a character typed (internal).
static final int
IME
Minor ID indicating a IME string typed (internal).
static final int
DRAGGED
Minor ID indicating a pointer drag.
static final int
MENU_REQUESTED
Minor ID indicating that command event requires posting a menu.
static final int
MENU_DISMISSED
Minor ID indicating that command event is dismissing a menu.
static final int
SYSTEM_KEY_POWER
The value returned from getSystemKey if the keyCode is the POWER key.
static final int
SYSTEM_KEY_SEND
The value returned from getSystemKey if the keyCode is SEND.
static final int
SYSTEM_KEY_END
The value returned from getSystemKey if the keyCode is END.
static final int
SYSTEM_KEY_CLEAR
The value returned from getSystemKey if the keyCode is CLEAR.
static final int
SUSPEND_ALL
Minor ID indicating a SYSTEM_EVENT to suspend all current activity
static final int
RESUME_ALL
Minor ID indicating a SYSTEM_EVENT to resume the currently suspended MIDlet (that is, the followup to a previous SUSPEND_CURRENT event)
static final int
SHUTDOWN
Minor ID indicating a SYSTEM_EVENT to stop all MIDlets (active and paused) and exit the system
static final int
SUSPEND_CURRENT
Minor ID indicating a SYSTEM_EVENT to pause the currently active MIDlet (and optionally return to the selector)
static final int
RESUME_PREVIOUS
Minor ID indicating a SYSTEM_EVENT to resume the currently paused MIDlet
static final int
KILL_CURRENT
Minor ID indicating a SYSTEM_EVENT to kill the currently active MIDlet (and optionally return to the selector)
Constructors Summary
Methods Summary
public voidclearSystemScreen()
Called to force the event handler to clear whatever system screen has interrupted the current Displayable and allow the foreground Display to resume painting.

public intgetGameAction(int keyCode)
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

public intgetKeyCode(int gameAction)
Get the system-specific key code corresponding to the given gameAction.

param
gameAction A game action
return
int The keyCode associated with that action

public java.lang.StringgetKeyName(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

public intgetSystemKey(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

public booleanisDispatchThread()
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

public voidscheduleCallSerially()
Called to schedule a serial callback of a Runnable object passed into Display's callSerially() method.

public voidscheduleInvalidate(javax.microedition.lcdui.Item src)
Called to schedule an invalidation of a Form

param
src the Item which may be causing the invalidation

public voidscheduleItemStateChanged(javax.microedition.lcdui.Item src)
Called to schedule an ItemStateChanged notification

param
src the Item which has changed

public voidscheduleRepaint(int x, int y, int w, int h, java.lang.Object target)
Called to schedule a repaint of the current Displayable as soon as possible

param
x The x coordinate of the origin of the repaint rectangle
param
y The y coordinate of the origin of the repaint rectangle
param
w The width of the repaint rectangle
param
h The height of the repaint rectangle
param
target An optional target Object, which may have been the original requestor for the repaint

public voidscheduleScreenChange(javax.microedition.lcdui.Display parent, javax.microedition.lcdui.Displayable d)
Called to schedule a screen change to the given Displayable as soon as possible

param
parent parent Display of the Displayable
param
d The Displayable to change to

public voidserviceRepaints()
Called to service any pending repaint operations

public voidupdateCommandSet(javax.microedition.lcdui.Command[] itemCommands, int numItemCommands, javax.microedition.lcdui.Command[] commands, int numCommands)
Set the current set of active Abstract Commands.

param
itemCommands The list of Item Commands that should be active
param
numItemCommands The number of Item commands in the list
param
commands The list of Commands that should be active
param
numCommands The number of commands in the list