All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class taxman.GameTable

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----taxman.GameTable

public class GameTable
extends Panel
implements GameUpdate
This panel serves as a location for placement of block numbers. It lays out everything in a grid, where the number of rows can be specified but not the number of columns. It can also handle gameUpdate events which allows it to clear itself and repaint on demand. There is one option for mouse event handling. If mouse event handling is enabled, the panel will remove the number that is selected and fire a numberChosen event.


Variable Index

 o DEF_BACK_COLOR
 o DEF_NUM_COLOR

Constructor Index

 o GameTable()
Does nothing

Method Index

 o addNumber(GUINumber)
Adds a number to the grid.
 o createTable(Board)
Each grid uses the same method to create a new grid.
 o gameUpdate(Board, Minimax, int)
This is the common update method for all GameUpdate objects.
 o removeNumber(int)
This method will remove the given number from the grid.
 o setNewGameLayout(Board)
Creates the layout for this grid and enforces it by filling it with invisible '0's which are overwritten by the real numbers later.
 o update(Graphics)
This is the standard update function for components.

Variables

 o DEF_NUM_COLOR
 public static final Color DEF_NUM_COLOR
 o DEF_BACK_COLOR
 public static final Color DEF_BACK_COLOR

Constructors

 o GameTable
 public GameTable()
Does nothing

Methods

 o gameUpdate
 public void gameUpdate(Board b,
                        Minimax m,
                        int flag)
This is the common update method for all GameUpdate objects. It's job is to keep the board synchronized with game state. In this case, gameUpdate only handles the NEW_GAME flag. This method should be called first by any inherited classes.

Parameters:
b - The current game board
m - The current minimax object
flag - a flag indicating the game state
 o addNumber
 public void addNumber(GUINumber gn)
Adds a number to the grid. Inherited classes can use this method to easily add numbers to the grid

Parameters:
gn - The number (GUINumber) to add to the grid
 o removeNumber
 public void removeNumber(int n)
This method will remove the given number from the grid. It is removed from the array of numbers as well as the layout.

Parameters:
n - The number to remove
 o update
 public void update(Graphics g)
This is the standard update function for components. it is overwritten to paint the sub-canvases inside the panel

Parameters:
g - The graphics context on which to draw
Overrides:
update in class Container
 o setNewGameLayout
 public void setNewGameLayout(Board b)
Creates the layout for this grid and enforces it by filling it with invisible '0's which are overwritten by the real numbers later.

Parameters:
b - The board representing the new game
 o createTable
 public void createTable(Board b)
Each grid uses the same method to create a new grid. This can be used by any inherited classes.

Parameters:
b - The board which gives information needed in creation

All Packages  Class Hierarchy  This Package  Previous  Next  Index