|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.ObjectBugWorldView
This class creates and manages a display view of a MatrixModel.
| Constructor Summary | |
BugWorldView(int viewRows,
int viewCols,
int cellWidth,
int cellHeight)
Create a new display of the given MatrixModel. |
|
| Method Summary | |
void |
addCritter(Critter bug,
int[] loc)
Add the given Critter to the collection of Critters we are displaying. |
uwcse.graphics.GWindow |
getGWindow()
Get the GWindow associated with this view for use by a MatrixController. |
void |
moveCritter(Critter bug,
int[] newLoc)
Update the display to reflect a new position for the given Critter. |
void |
removeCritter(Critter bug)
Remove the given Critter from the collection of Critters we are displaying. |
void |
resumeRepaints()
Resume repainting this view's window. |
void |
suspendRepaints()
Suspend repainting this view's window because we are going to do a bunch of updates. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BugWorldView(int viewRows,
int viewCols,
int cellWidth,
int cellHeight)
viewRows - the height of the view into the cell array.
Specify as the number of model cells in the vertical direction
to display.viewCols - the width of the view into the cell array.
Specify as the number of model cells in the horizontal direction
to display.cellWidth - the width of each individual Critter cell on the screen
in pixelscellHeight - the height of each individual Critter cell on the screen
in pixels| Method Detail |
public uwcse.graphics.GWindow getGWindow()
MatrixView
getGWindow in interface MatrixViewMatrixView.getGWindow()
public void addCritter(Critter bug,
int[] loc)
MatrixView
addCritter in interface MatrixViewbug - the Critter to addloc - a 2-element int array containing the current cell location
of this Critter. The row address is in element [0] and
the column address is in element [1].MatrixView.addCritter(Critter, int[])public void removeCritter(Critter bug)
MatrixView
removeCritter in interface MatrixViewbug - the Critter to removeMatrixView.removeCritter(Critter)
public void moveCritter(Critter bug,
int[] newLoc)
MatrixView
moveCritter in interface MatrixViewbug - the Critter to movenewLoc - a 2-element int array containing the new cell location
of this Critter. The row address is in element [0] and
the column address is in element [1].MatrixView.moveCritter(Critter, int[])public void resumeRepaints()
MatrixView
resumeRepaints in interface MatrixViewMatrixView.resumeRepaints()public void suspendRepaints()
MatrixView
suspendRepaints in interface MatrixViewMatrixView.suspendRepaints()
|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||