de.enough.polish.ui
Class MasterCanvas

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by de.enough.polish.ui.MasterCanvas

public class MasterCanvas
extends javax.microedition.lcdui.Canvas

Is used for only displaying a single canvas for devices that flicker between screen changes.

Copyright (c) Enough Software 2005 - 2008

 history
        03-Jun-2005 - rob creation
 

Author:
Robert Virkus, j2mepolish@enough.de

Field Summary
protected  AccessibleCanvas currentCanvas
           
protected  javax.microedition.lcdui.Displayable currentDisplayable
           
static MasterCanvas instance
          the master canvas that actually displays the canvas that should be shown
 
Fields inherited from class javax.microedition.lcdui.Canvas
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP
 
Method Summary
static javax.microedition.lcdui.Displayable getCurrent(javax.microedition.lcdui.Display display)
          Retrieves the currently shown displayable.
static int getScreenHeight()
           
static int getScreenWidth()
           
protected  void hideNotify()
           
static boolean isAccessibleCanvasShown(AccessibleCanvas canvas)
          Determines if the specified canvas is currently being shown
static boolean isCanvasShown(javax.microedition.lcdui.Canvas canvas)
          Determines if the specified canvas is currently being shown
static boolean isDisplayableShown(javax.microedition.lcdui.Displayable displayable)
          Determines if the specified displayable is currently being shown
protected  void keyPressed(int keyCode)
           
protected  void keyReleased(int keyCode)
           
protected  void keyRepeated(int keyCode)
           
protected  void paint(javax.microedition.lcdui.Graphics g)
           
protected  void pointerDragged(int x, int y)
           
protected  void pointerPressed(int x, int y)
           
protected  void pointerReleased(int x, int y)
           
static void repaintAccessibleCanvas(AccessibleCanvas canvas)
          Repaints an accessible canvas.
static void repaintCanvas(javax.microedition.lcdui.Canvas canvas)
          Repaints a normal canvas
static void repaintCanvas(javax.microedition.lcdui.Canvas canvas, int x, int y, int width, int height)
          Repaints the specified area of a normal canvas
static void setCurrent(javax.microedition.lcdui.Display display, javax.microedition.lcdui.Displayable nextDisplayable)
          Sets the current screen/displayable.
protected  void showNotify()
           
protected  void sizeChanged(int width, int height)
           
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, isDoubleBuffered, repaint, repaint, serviceRepaints, setFullScreenMode
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setCommandListener, setTicker, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static MasterCanvas instance
the master canvas that actually displays the canvas that should be shown


currentCanvas

protected AccessibleCanvas currentCanvas

currentDisplayable

protected javax.microedition.lcdui.Displayable currentDisplayable
Method Detail

hideNotify

protected void hideNotify()
Overrides:
hideNotify in class javax.microedition.lcdui.Canvas

showNotify

protected void showNotify()
Overrides:
showNotify in class javax.microedition.lcdui.Canvas

keyPressed

protected void keyPressed(int keyCode)
Overrides:
keyPressed in class javax.microedition.lcdui.Canvas

keyRepeated

protected void keyRepeated(int keyCode)
Overrides:
keyRepeated in class javax.microedition.lcdui.Canvas

keyReleased

protected void keyReleased(int keyCode)
Overrides:
keyReleased in class javax.microedition.lcdui.Canvas

pointerPressed

protected void pointerPressed(int x,
                              int y)
Overrides:
pointerPressed in class javax.microedition.lcdui.Canvas

pointerReleased

protected void pointerReleased(int x,
                               int y)
Overrides:
pointerReleased in class javax.microedition.lcdui.Canvas

pointerDragged

protected void pointerDragged(int x,
                              int y)
Overrides:
pointerDragged in class javax.microedition.lcdui.Canvas

sizeChanged

protected void sizeChanged(int width,
                           int height)
Overrides:
sizeChanged in class javax.microedition.lcdui.Canvas

getScreenHeight

public static int getScreenHeight()

getScreenWidth

public static int getScreenWidth()

paint

protected void paint(javax.microedition.lcdui.Graphics g)
Specified by:
paint in class javax.microedition.lcdui.Canvas

setCurrent

public static void setCurrent(javax.microedition.lcdui.Display display,
                              javax.microedition.lcdui.Displayable nextDisplayable)
Sets the current screen/displayable.

Parameters:
display - the display
nextDisplayable - the screen/displayable that should be shown

getCurrent

public static javax.microedition.lcdui.Displayable getCurrent(javax.microedition.lcdui.Display display)
Retrieves the currently shown displayable.

Parameters:
display - the display that is being used to change displayables
Returns:
the currently shown displayable.

repaintAccessibleCanvas

public static void repaintAccessibleCanvas(AccessibleCanvas canvas)
Repaints an accessible canvas.

Parameters:
canvas - the canvas that requires a repaint

repaintCanvas

public static void repaintCanvas(javax.microedition.lcdui.Canvas canvas)
Repaints a normal canvas

Parameters:
canvas - the canvas that requires a repaint

repaintCanvas

public static void repaintCanvas(javax.microedition.lcdui.Canvas canvas,
                                 int x,
                                 int y,
                                 int width,
                                 int height)
Repaints the specified area of a normal canvas

Parameters:
canvas - the canvas that should be repainted partically
x - horizontal start
y - vertical start
width - width
height - height of the the repaint area in pixels

isAccessibleCanvasShown

public static boolean isAccessibleCanvasShown(AccessibleCanvas canvas)
Determines if the specified canvas is currently being shown

Parameters:
canvas - the canvas
Returns:
true when the canvas is currently the first display on the screen

isCanvasShown

public static boolean isCanvasShown(javax.microedition.lcdui.Canvas canvas)
Determines if the specified canvas is currently being shown

Parameters:
canvas - the canvas
Returns:
true when the canvas is currently the first display on the screen

isDisplayableShown

public static boolean isDisplayableShown(javax.microedition.lcdui.Displayable displayable)
Determines if the specified displayable is currently being shown

Parameters:
displayable - the displayayable
Returns:
true when the canvas is currently the first display on the screen