Methods Summary |
---|
void | addEmbeddedVideo(java.lang.Object video)Add embedded video player.
This is called by MMHelperImpl , whenever a video
player joins this canvas.
embeddedVideos.addElement(video);
|
private boolean | allowKey(int keyCode)Test to see if the given keyCode should be sent to
the application.
if (!canvas.suppressKeyEvents) {
return true;
}
switch (KeyConverter.getGameAction(keyCode)) {
case -1:
// Invalid keycode, don't block this key.
return true;
case Canvas.UP:
case Canvas.DOWN:
case Canvas.LEFT:
case Canvas.RIGHT:
case Canvas.FIRE:
case Canvas.GAME_A:
case Canvas.GAME_B:
case Canvas.GAME_C:
case Canvas.GAME_D :
// don't generate key events for the defined game keys
return false;
default:
return true;
}
|
void | createNativeResource()Create and show native resource for this Canvas .
nativeId = createNativeResource0(canvas.title,
canvas.ticker == null ? null : canvas.ticker.getString());
|
private native int | createNativeResource0(java.lang.String title, java.lang.String tickerText)Create and show native resource for this Canvas .
|
public void | lRepaint(int x, int y, int width, int height, java.lang.Object target)Notifies look & feel object that repaint of a (x, y, width, height)
area is needed.
SYNC NOTE: The caller of this method handles synchronization.
lRequestPaint(x, y, width, height, target);
|
public void | lRepaint()Notifies that repaint of the entire Canvas look&feel
is needed.
Repaints the viewport area.
SYNC NOTE: The caller of this method handles synchronization.
lRequestPaintContents();
|
void | removeEmbeddedVideo(java.lang.Object video)Remove embedded video player.
This is called by MMHelperImpl , whenever a video
player leaves this canvas.
embeddedVideos.removeElement(video);
|
public void | uCallFreeze()Notify this Canvas that it is being frozen on the
given Display .
int oldState = state;
// Delete native resources including title and ticker
super.uCallFreeze();
// Notify canvas subclass after hiding the native resource
synchronized (Display.calloutLock) {
if (oldState == SHOWN) {
try {
canvas.hideNotify();
// For MMAPI VideoControl in a Canvas
if (mmHelper != null) {
for (Enumeration e = embeddedVideos.elements();
e.hasMoreElements();) {
mmHelper.hideVideo(e.nextElement());
}
}
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
}
|
public void | uCallHide()Notify this Canvas that it is being hidden on the
given Display .
int oldState = state;
// Delete native resources including title and ticker
super.uCallHide();
// Notify canvas subclass after hiding the native resource
synchronized (Display.calloutLock) {
if (oldState == SHOWN) {
try {
canvas.hideNotify();
/* For MMAPI VideoControl in a Canvas */
if (mmHelper != null) {
for (Enumeration e = embeddedVideos.elements();
e.hasMoreElements();) {
mmHelper.hideVideo(e.nextElement());
}
}
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
}
|
void | uCallKeyPressed(int keyCode)Handle a key press.
if (allowKey(keyCode)) {
synchronized (Display.calloutLock) {
try {
canvas.keyPressed(keyCode);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
}
|
void | uCallKeyReleased(int keyCode)Handle a key release.
if (allowKey(keyCode)) {
synchronized (Display.calloutLock) {
try {
canvas.keyReleased(keyCode);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
}
|
void | uCallKeyRepeated(int keyCode)Handle a repeated key press.
if (allowKey(keyCode)) {
synchronized (Display.calloutLock) {
try {
canvas.keyRepeated(keyCode);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
}
|
public void | uCallPaint(Graphics g, java.lang.Object target)Paint this Canvas .
super.uCallPaint(g, target);
// We prevent the Canvas from drawing outside of the
// allowable viewport.
// We also need to preserve the original translation.
// g.preserveMIDPRuntimeGC(x, y, WIDTH, HEIGHT);
// Reset the graphics context according to the spec. requirement.
// This is a must before we call canvas's paint(g) since the
// title or ticker drawing routines may change the GC before.
g.resetGC();
try {
synchronized (Display.calloutLock) {
canvas.paint(g);
}
} catch (Throwable t) {
Display.handleThrowable(t);
}
// If there are any video players in this canvas,
// let the helper class invoke video rendering
// Update frames of any video players displayed on this Canvas
if (mmHelper != null) {
for (Enumeration e = embeddedVideos.elements();
e.hasMoreElements();) {
mmHelper.paintVideo(e.nextElement(), g);
}
}
// g.restoreMIDPRuntimeGC();
|
void | uCallPointerDragged(int x, int y)Handle a pointer drag event.
synchronized (Display.calloutLock) {
try {
canvas.pointerDragged(x, y);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
|
void | uCallPointerPressed(int x, int y)Handle a pointer press event.
synchronized (Display.calloutLock) {
try {
canvas.pointerPressed(x, y);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
|
void | uCallPointerReleased(int x, int y)Handle a pointer release event.
synchronized (Display.calloutLock) {
try {
canvas.pointerReleased(x, y);
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
|
public void | uCallShow()Notify this Canvas that it is being shown on the
given Display .
// Create native resource with title and ticker
super.uCallShow();
// Notify the canvas subclass before showing native resource
synchronized (Display.calloutLock) {
try {
canvas.showNotify();
/* For MMAPI VideoControl in a Canvas */
if (mmHelper != null) {
for (Enumeration e = embeddedVideos.elements();
e.hasMoreElements();) {
mmHelper.showVideo(e.nextElement());
}
}
} catch (Throwable t) {
Display.handleThrowable(t);
}
}
|
public void | uServiceRepaints()Request serviceRepaints from current Display .
SYNC NOTE: Unlike most other LF methods, no locking is held when
this function is called because Display.serviceRepaints()
needs to handle its own locking.
// Avoid locking by making a copy of currentDisplay
// -- an atomic operation -- before testing and using it.
Display d = currentDisplay;
if (d != null) {
d.serviceRepaints(this);
}
|