Class Board

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----Board

class Board
extends Canvas
Board : jGames Boards' super class
 this contain all the needed methods to build a Board for jGames 
 

Version:
1.0b1 25/04/98

Variable Index

 o horizBoard
 o initDone
 o myH
 o mysize
 o myW
 o owner
 o tab
 o tH
 o tW

Constructor Index

 o Board()
constructror

Method Index

 o getClickValue(int, int)
this method should be overwriten, this is from where you give the value of the click to Game Panel
 o getImage(String)
This method is in charge of downloading images for you.
 o init(Gpanel)
This method must be overwriten by the Game Board, from there you gives vars to the super class.
 o minimumSize()
This is just needed
 o mouseDown(Event, int, int)
catch mouse clicks and send x,y coordinates of the click in the Image defined by the user, to getClickValue.
 o paint(Graphics)
paint() create a new Graphics on which we will draw offscreen then it displays this graphics when it's finished.
 o paintBoard(Graphics)
This method must be overwriten by the Game Board, this where you draw the board
 o preferredSize()
This is just needed
 o setVars(Gpanel, int[], int, int, boolean)
this is called by game boards to be sure all the vars are set right in the super class
 o tH()
This method calcul the position where to draw the Board (top corner)
 o tW()
This method calcul the position where to draw the Board (left corner)
 o update(Graphics)
This overwrite the Component update(Graphics g) method that normally clean up the Canvas making it flicker

Variables

 o tab
 public int tab[]
 o myW
 public int myW
 o myH
 public int myH
 o horizBoard
 public boolean horizBoard
 o tH
 int tH
 o tW
 int tW
 o mysize
 Dimension mysize
 o initDone
 boolean initDone
 o owner
 Gpanel owner

Constructors

 o Board
 public Board()
constructror

Methods

 o setVars
 public void setVars(Gpanel o,
                     int t[],
                     int W,
                     int H,
                     boolean h)
this is called by game boards to be sure all the vars are set right in the super class

 o update
 public void update(Graphics g)
This overwrite the Component update(Graphics g) method that normally clean up the Canvas making it flicker

Overrides:
update in class Component
 o paint
 public void paint(Graphics g)
paint() create a new Graphics on which we will draw offscreen then it displays this graphics when it's finished. This avoid flickering and is called double buffering

Overrides:
paint in class Canvas
 o paintBoard
 public void paintBoard(Graphics pre)
This method must be overwriten by the Game Board, this where you draw the board

 o init
 public void init(Gpanel owner)
This method must be overwriten by the Game Board, from there you gives vars to the super class. and do all that needed at start such as loading images

 o getImage
 public Image getImage(String imageName)
This method is in charge of downloading images for you. Login.sURL is the URL of the directory from where this applet was downloaded.

 o tW
 int tW()
This method calcul the position where to draw the Board (left corner)

 o tH
 int tH()
This method calcul the position where to draw the Board (top corner)

 o mouseDown
 public boolean mouseDown(Event evt,
                          int xC,
                          int yC)
catch mouse clicks and send x,y coordinates of the click in the Image defined by the user, to getClickValue.

Overrides:
mouseDown in class Component
 o getClickValue
 public void getClickValue(int xC,
                           int yC)
this method should be overwriten, this is from where you give the value of the click to Game Panel

 o minimumSize
 public Dimension minimumSize()
This is just needed

Overrides:
minimumSize in class Component
 o preferredSize
 public Dimension preferredSize()
This is just needed

Overrides:
preferredSize in class Component