org.dartra.midpui
Class PlayDartsCanvas

java.lang.Object
  extended byjavax.microedition.lcdui.Displayable
      extended byjavax.microedition.lcdui.Canvas
          extended byorg.dartra.midpui.PlayDartsCanvas
Direct Known Subclasses:
GameCanvas, ScoreBoardCanvas

public abstract class PlayDartsCanvas
extends javax.microedition.lcdui.Canvas

A general purpose canvas used by the PlayDarts MIDlet.

This class has support for a button in the top left and top right part of the screen.

Author:
Erwin Vervaet

Field Summary
protected  javax.microedition.lcdui.Image backgroundImage
          The background image of the canvas
protected  javax.microedition.lcdui.Image leftTopButtonPressedImage
          The image overlay when the left top button is pressed.
protected  PlayDarts midlet
          The MIDlet that is using this canvas.
protected  javax.microedition.lcdui.Image rightTopButtonPressedImage
          The image overlay when the right top button is pressed.
 
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
 
Constructor Summary
PlayDartsCanvas(PlayDarts midlet, java.lang.String bgImageName, java.lang.String leftTopButtonPressedImageName, java.lang.String rightTopButtonPressedImageName)
           
 
Method Summary
 boolean inLeftTopButton(int x, int y)
          Returns whether or not given coordinates are inside the left top button area.
 boolean inRightTopButton(int x, int y)
          Returns whether or not given coordinates are inside the right top button area.
protected  void paint(javax.microedition.lcdui.Graphics g)
           
protected  void pointerPressed(int x, int y)
           
protected  void pointerReleased(int x, int y)
           
abstract  void processClick(int x, int y)
          Called when the screen is clicked at any location other than inside the top left or top right buttons.
abstract  void processLeftTopButtonClick()
          Called when the top left button is clicked.
abstract  void processRightTopButtonClick()
          Called when the top right button is clicked.
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyPressed, keyReleased, keyRepeated, pointerDragged, repaint, repaint, serviceRepaints, setFullScreenMode, showNotify, sizeChanged
 
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

midlet

protected PlayDarts midlet

The MIDlet that is using this canvas.


backgroundImage

protected javax.microedition.lcdui.Image backgroundImage

The background image of the canvas


leftTopButtonPressedImage

protected javax.microedition.lcdui.Image leftTopButtonPressedImage

The image overlay when the left top button is pressed.


rightTopButtonPressedImage

protected javax.microedition.lcdui.Image rightTopButtonPressedImage

The image overlay when the right top button is pressed.

Constructor Detail

PlayDartsCanvas

public PlayDartsCanvas(PlayDarts midlet,
                       java.lang.String bgImageName,
                       java.lang.String leftTopButtonPressedImageName,
                       java.lang.String rightTopButtonPressedImageName)
Method Detail

paint

protected void paint(javax.microedition.lcdui.Graphics g)

pointerPressed

protected void pointerPressed(int x,
                              int y)

pointerReleased

protected void pointerReleased(int x,
                               int y)

inLeftTopButton

public boolean inLeftTopButton(int x,
                               int y)

Returns whether or not given coordinates are inside the left top button area.


inRightTopButton

public boolean inRightTopButton(int x,
                                int y)

Returns whether or not given coordinates are inside the right top button area.


processLeftTopButtonClick

public abstract void processLeftTopButtonClick()

Called when the top left button is clicked.


processRightTopButtonClick

public abstract void processRightTopButtonClick()

Called when the top right button is clicked.


processClick

public abstract void processClick(int x,
                                  int y)

Called when the screen is clicked at any location other than inside the top left or top right buttons.