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
-
horizBoard
-
-
initDone
-
-
myH
-
-
mysize
-
-
myW
-
-
owner
-
-
tab
-
-
tH
-
-
tW
-
-
Board()
- constructror
-
getClickValue(int, int)
- this method should be overwriten, this is from where you give
the value of the click to Game Panel
-
getImage(String)
- This method is in charge of downloading images for you.
-
init(Gpanel)
- This method must be overwriten by the Game Board, from there you gives
vars to the super class.
-
minimumSize()
- This is just needed
-
mouseDown(Event, int, int)
- catch mouse clicks and send x,y coordinates of the click in the
Image defined by the user, to getClickValue.
-
paint(Graphics)
- paint() create a new Graphics on which we will draw offscreen
then it displays this graphics when it's finished.
-
paintBoard(Graphics)
- This method must be overwriten by the Game Board, this where you
draw the board
-
preferredSize()
- This is just needed
-
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
-
tH()
- This method calcul the position where to draw the Board (top corner)
-
tW()
- This method calcul the position where to draw the Board (left corner)
-
update(Graphics)
- This overwrite the Component update(Graphics g) method that
normally clean up the Canvas making it flicker
tab
public int tab[]
myW
public int myW
myH
public int myH
horizBoard
public boolean horizBoard
tH
int tH
tW
int tW
mysize
Dimension mysize
initDone
boolean initDone
owner
Gpanel owner
Board
public Board()
- constructror
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
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
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
paintBoard
public void paintBoard(Graphics pre)
- This method must be overwriten by the Game Board, this where you
draw the board
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
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.
tW
int tW()
- This method calcul the position where to draw the Board (left corner)
tH
int tH()
- This method calcul the position where to draw the Board (top corner)
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
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
minimumSize
public Dimension minimumSize()
- This is just needed
- Overrides:
- minimumSize in class Component
preferredSize
public Dimension preferredSize()
- This is just needed
- Overrides:
- preferredSize in class Component