GUI
Class GUIOptionPane

java.lang.Object
  extended by GUI.GUIOptionPane

public class GUIOptionPane
extends java.lang.Object

Class rensponsible for creating and showing all the appropriate windows to the screen.


Constructor Summary
GUIOptionPane()
           
 
Method Summary
static void bankruptWindow(java.lang.String name)
          Method invoked whether a player has declared bunkrupcy.
static void deptWindow(Monopoly game, int dept)
          Method invoked to handle the case in which a player has a dept.
static void ExitingWindow()
          Method invoked whether program is about to exit.
static int getRounds()
          Method invoked in the beginning of every new game to prompt user to enter the game rounds.
static java.lang.String houseAction(java.lang.Object[] streets, java.lang.String command)
          Method invoked when user decides that he wants to buy(or sell) a house to one of his/her streets.
static int jailWindow(boolean hasJailCard, java.lang.String playername)
          Method invoked when user has previously sent to jail.
static java.lang.String mortageProperty(java.lang.Object[] properties, java.lang.String command)
          Method invoked when user decides that he wants to mortage one of his/her properties .
static boolean NewGameWindow()
          Method invoked when a new game is about to start.
static void notEnoughMoney()
          Method invoked when a player is trying to perform an action and he/she doesn't have enough money to do so.
static int purchaseProperty(Monopoly game)
          Method invoked whether user must decide whether he/she wants to buy a property cell.
static void showIntro()
          Method used to create and show the intro window in the screen, which contains information about the designers of the game.
static void showRent(GUI grid, java.lang.String str)
          Method invoked when user is about to pay rent.
static void WonWindow(java.lang.String playerName, int fortune)
          Method invoked whether a player has won a game (and thus all other player have lost).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUIOptionPane

public GUIOptionPane()
Method Detail

showIntro

public static void showIntro()
Method used to create and show the intro window in the screen, which contains information about the designers of the game.


NewGameWindow

public static boolean NewGameWindow()
Method invoked when a new game is about to start. Through a JOptinPane user is prompt to decide whether he want to start a new game. If he clicks yes then a new game starts and all previous gameplay is lost, otherwise the current game continues

Returns:
true if and only if user wants to start a new game.

getRounds

public static int getRounds()
Method invoked in the beginning of every new game to prompt user to enter the game rounds. A non positive integer stands for infitive rounds. Method also checks if user's imported value is an acceptable integer.

Returns:
the game round's.

purchaseProperty

public static int purchaseProperty(Monopoly game)
Method invoked whether user must decide whether he/she wants to buy a property cell.

Parameters:
game - The current Monopoly game.
Returns:
1 if and only if user wants to buy that property, otherwise returns 0.

houseAction

public static java.lang.String houseAction(java.lang.Object[] streets,
                                           java.lang.String command)
Method invoked when user decides that he wants to buy(or sell) a house to one of his/her streets. In order for user to buy (or sell) a house, he/she must have all the streets of the same color to his/her properties. If he/she doesn't have all the necessary properties then an appropriate warning window is displayed to inform him/her of that fact.

Parameters:
streets - the streets of the active Player.
command - the command user has choosen to perform.
Returns:
the street for which user has choosen to build or sell a house.

mortageProperty

public static java.lang.String mortageProperty(java.lang.Object[] properties,
                                               java.lang.String command)
Method invoked when user decides that he wants to mortage one of his/her properties . In order for user to mortage a property, he/she must have at least one property, otherwise an appropriate warning window is displayed to inform him/her of that fact.

Parameters:
properties - the properties of the active Player.
command - the command user has choosen to perform.
Returns:
the property which which user has choosen to mortage.

jailWindow

public static int jailWindow(boolean hasJailCard,
                             java.lang.String playername)
Method invoked when user has previously sent to jail. When in jail user has a variety of option regarding what he can do to get out of jail, and this method handles all the acceptable choices, and returns the selected one.

Parameters:
hasJailCard - true if and only if user has a get out of jail card, otherwise false.
playername - the active player's name.
Returns:
the selected choice - command.

deptWindow

public static void deptWindow(Monopoly game,
                              int dept)
Method invoked to handle the case in which a player has a dept. This method is rensponsible for calling all the necessary methods, because user may trade, may mortage or may bunkrupt until the dept is paid.

Parameters:
game - the current Monopoly game.
dept - the dept the active player have to an other player or to the bank.

showRent

public static void showRent(GUI grid,
                            java.lang.String str)
Method invoked when user is about to pay rent.

Parameters:
grid - the current gui of the program.
str - the string that is to be viewed in this JOptionPane.

notEnoughMoney

public static void notEnoughMoney()
Method invoked when a player is trying to perform an action and he/she doesn't have enough money to do so.


bankruptWindow

public static void bankruptWindow(java.lang.String name)
Method invoked whether a player has declared bunkrupcy. Bankrupsy may occur when a player decides to do so, or when he doesn't have any other property to mortage (and no cash at all)

Parameters:
name - The bankrupted player name.

WonWindow

public static void WonWindow(java.lang.String playerName,
                             int fortune)
Method invoked whether a player has won a game (and thus all other player have lost).

Parameters:
playerName - the winning player's name.
fortune - the winning player's money.

ExitingWindow

public static void ExitingWindow()
Method invoked whether program is about to exit. Program may exit when user clicks on the x button in the main frame window, or if user clicks on the exit prompt in the menu. (thus pressing ALT - F4 in the keyboard).