|
||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--YahtzeeDisplay
public class YahtzeeDisplay
The YahtzeeDisplay class provides the methods you need to control the display. You should look at the descriptions of all the methods in this documentation and familiarize yourself with their operation.
Constructor Summary |
YahtzeeDisplay(GCanvas gc,
String[] playerNames) |
Method Summary | |
void | displayDice(int[] dice) |
boolean | isDieSelected(int index) |
void | printMessage(String message) |
void | updateScorecard(int category,
int player,
int score) |
void | waitForPlayerToClickRoll(int player) |
int | waitForPlayerToSelectCategory() |
void | waitForPlayerToSelectDice() |
Constructor Detail |
public YahtzeeDisplay(GCanvas gc,
String[] playerNames)
Usage: | YahtzeeDisplay display = new YahtzeeDisplay(gc, playerNames); | ||||
Parameters: |
|
Method Detail |
public void displayDice(int[] dice)
Usage: | display.displayDice(dice); | ||
Parameter: |
|
public boolean isDieSelected(int index)
Usage: | if (display.isDieSelected(index)) . . . | ||
Parameter: |
| ||
Returns: | true if the die is selected, and false otherwise |
public void printMessage(String message)
Usage: | display.printMessage(message); | ||
Parameter: |
|
public void updateScorecard(int category,
int player,
int score)
Usage: | display.updateScorecard(category, player, score); | ||||||
Parameters: |
|
public void waitForPlayerToClickRoll(int player)
Usage: | display.waitForPlayerToClickRoll(player); | ||
Parameter: |
|
public int waitForPlayerToSelectCategory()
Note that this method does not check to see whether the category is valid for the dice values or whether this category has already been used by this player. Thus, you will need to include some error-checking in your program to test the result of waitForPlayerToSelectCategory before you try to update the scorecard.
Usage: | int category = display.waitForPlayerToSelectCategory(); |
Returns: | The category number selected by the player |
public void waitForPlayerToSelectDice()
Usage: | display.waitForPlayerToSelectDice(); |
|
||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |