public class GUI
extends MonopolyUI
STUDENTS SHOULD NOT CHANGE THE CONTENTS OF THIS FILE IN ANY WAY.
| Modifier and Type | Field and Description |
|---|---|
private static int |
AUTO_PLAY_SPEED |
private boolean |
autoPlay |
private javax.swing.JPanel[] |
dicePanels |
private static java.awt.Font |
FONT |
private Game |
game |
private static int |
GRID_SIZE |
private static java.awt.Color[] |
GROUP_COLORS |
private static javax.swing.ImageIcon |
IMAGE_CHANCE |
private static javax.swing.ImageIcon[] |
IMAGE_DIE |
private static javax.swing.ImageIcon |
IMAGE_FREE_PARKING |
private static javax.swing.ImageIcon |
IMAGE_GO |
private static javax.swing.ImageIcon |
IMAGE_GOTO_JAIL |
private static javax.swing.ImageIcon |
IMAGE_HOUSE |
private static javax.swing.ImageIcon |
IMAGE_JAIL |
private static javax.swing.ImageIcon[] |
IMAGE_PAWNS |
private java.util.Map<Player,javax.swing.JPanel> |
playerPanels |
private java.util.Map<Player,javax.swing.ImageIcon> |
playerPawns |
private java.util.Map<Property,javax.swing.JPanel> |
propertyPanels |
private javax.swing.JPanel[][] |
slots |
private javax.swing.JPanel[] |
spacePanels |
private javax.swing.JFrame |
window |
| Constructor and Description |
|---|
GUI(Game game) |
| Modifier and Type | Method and Description |
|---|---|
Property |
askForProperty(Player player,
java.util.ArrayList<Property> list)
Displays a drop-down menu of properties for which the player may purchase
houses.
|
boolean |
askQuestion(Player player,
java.lang.String str)
Displays a question prompt for a particular user with "yes" and "no"
options.
|
boolean |
askQuestion(java.lang.String str)
Display a question prompt with "yes" and "no" options.
|
private void |
createBoard() |
private void |
createCenter() |
private javax.swing.JFrame |
createWindow() |
void |
displayDice(int dieOne,
int dieTwo)
Display the current values of the dice
|
void |
displayMessage(Player player,
java.lang.String str)
Displays a message that does not require a response for a particular user
|
void |
displayMessage(java.lang.String str)
Displays a message that does not require a response.
|
void |
end()
Close the GUI.
|
void |
movePawn(int start,
int end)
Move a pawn around the board.
|
void |
redrawProperty(Property property)
Refresh property information in the GUI.
|
void |
refreshPlayers()
Refresh player information in the GUI.
|
private void |
rescaleImages() |
private javax.swing.ImageIcon |
scaleImage(javax.swing.ImageIcon icon,
double height) |
void |
setAutoPlay(boolean enable)
Enables automatic game play.
|
void |
switchPlayers(int currPlayer,
int nextPlayer)
Update GUI to transfer game play from one player to another.
|
private static final int GRID_SIZE
private static final java.awt.Color[] GROUP_COLORS
private static final int AUTO_PLAY_SPEED
private javax.swing.JFrame window
private javax.swing.JPanel[][] slots
private java.util.Map<Property,javax.swing.JPanel> propertyPanels
private javax.swing.JPanel[] spacePanels
private java.util.Map<Player,javax.swing.JPanel> playerPanels
private javax.swing.JPanel[] dicePanels
private java.util.Map<Player,javax.swing.ImageIcon> playerPawns
private boolean autoPlay
private Game game
private static javax.swing.ImageIcon IMAGE_HOUSE
private static javax.swing.ImageIcon IMAGE_GO
private static javax.swing.ImageIcon IMAGE_JAIL
private static javax.swing.ImageIcon IMAGE_FREE_PARKING
private static javax.swing.ImageIcon IMAGE_GOTO_JAIL
private static javax.swing.ImageIcon IMAGE_CHANCE
private static final javax.swing.ImageIcon[] IMAGE_PAWNS
private static final javax.swing.ImageIcon[] IMAGE_DIE
private static java.awt.Font FONT
private javax.swing.JFrame createWindow()
private javax.swing.ImageIcon scaleImage(javax.swing.ImageIcon icon,
double height)
private void rescaleImages()
private void createBoard()
private void createCenter()
public void switchPlayers(int currPlayer,
int nextPlayer)
switchPlayers in class MonopolyUIcurrPlayer - The current playernextPlayer - The next playerpublic void refreshPlayers()
refreshPlayers in class MonopolyUIpublic void redrawProperty(Property property)
redrawProperty in class MonopolyUIproperty - The property to updatepublic void movePawn(int start,
int end)
movePawn in class MonopolyUIstart - Starting locationend - Ending locationpublic void displayDice(int dieOne,
int dieTwo)
displayDice in class MonopolyUIdieOne - The first diedieTwo - The second diepublic boolean askQuestion(java.lang.String str)
askQuestion in class MonopolyUIstr - The question to displaypublic boolean askQuestion(Player player,
java.lang.String str)
askQuestion in class MonopolyUIplayer - The player to display the prompt tostr - The question to displaypublic void displayMessage(java.lang.String str)
displayMessage in class MonopolyUIstr - The message to displaypublic void displayMessage(Player player,
java.lang.String str)
displayMessage in class MonopolyUIplayer - The player to display the message tostr - The message to displaypublic Property askForProperty(Player player,
java.util.ArrayList<Property> list)
askForProperty in class MonopolyUIplayer - The player to display the prompt tolist - The list of properties for which the player may purchase housespublic void end()
end in class MonopolyUIpublic void setAutoPlay(boolean enable)
setAutoPlay in class MonopolyUIenable - If true, then enable automatic game play. Otherwise, disable.