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.
-
DEF_BACK_COLOR
-
-
DEF_NUM_COLOR
-
-
GameTable()
- Does nothing
-
addNumber(GUINumber)
- Adds a number to the grid.
-
createTable(Board)
- Each grid uses the same method to create a new grid.
-
gameUpdate(Board, Minimax, int)
- This is the common update method for all GameUpdate objects.
-
removeNumber(int)
- This method will remove the given number from the grid.
-
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.
-
update(Graphics)
- This is the standard update function for components.
DEF_NUM_COLOR
public static final Color DEF_NUM_COLOR
DEF_BACK_COLOR
public static final Color DEF_BACK_COLOR
GameTable
public GameTable()
- Does nothing
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
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
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
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
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
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