au.com.solidsoftware.multimahjong.mmc.game
Class PayoutGUI

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--au.com.solidsoftware.multimahjong.mmc.game.PayoutGUI

class PayoutGUI
extends javax.swing.JFrame

The PayoutGUI class is used to display a breakdown of the scoring information for the winning player's hand, and also the payouts made to the winner from all losing players.

See Also:
PayoutInfo, PayoutGUI, Game, Serialized Form

Inner Class Summary
(package private)  class PayoutGUI.CustomModel
           
 
Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
private  Tile[] concealedHand
          Concealed Tiles from Special Hands set by the Game
private  java.lang.String[][] doublesScoreData
          Contains the double data for the doubles JTable if the winner has an Ordinary Suit Hand.
private  Game gameReference
          A reference to the game in order to halt the game until the "OK" button of the Payout Window has been clicked.
private  java.lang.String[][] groundScoreData
          Contains the data which is to be inserted into the JTable containing ground score information for an Ordinary Suit Hand.
private  int handLimit
          The limit for a hand.
private  int IN_PANEL_SEPARATION
          Defines the number of pixels separating items contained within panels panels.
private  boolean isSpecialHand
          Indicates whether the player won with a special hand.
private  java.lang.String[][] losingPlayersData
          Contains the information concerning all losing players.
private  int PANEL_SEPARATION
          Defines the number of pixels separating panels contained in the JFrame.
private  java.lang.String specialHandDescription
          Holds the description of the special hand the player won with if they have a special hand.
private  java.lang.String specialHandName
          Holds the name of the special hand that the winner won with, if they have a special hand.
private  int TILE_SEPARATION
          Defines the number of pixels separating the sets of tiles
private  int totalGroundScore
          Contains the total ground score for the winner's hand if they have an Ordinary Suit Hand.
private  int totalNoOfDoubles
          Contains the total number of doubles earnt for the winner's hand if they have an Ordinary Suit Hand).
private  int totalPayout
          Total payout to the winner.
private  int totalScore
          Holds the total score of the player's hand.
private  java.lang.String winnersName
          Holds the winner's name.
private  java.lang.String winnersWind
          Holds the winner's wind.
 
Fields inherited from class javax.swing.JFrame
accessibleContext, defaultCloseOperation, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
base, CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, frameSerializedDataVersion, HAND_CURSOR, icon, ICONIFIED, mbManagement, menuBar, MOVE_CURSOR, N_RESIZE_CURSOR, nameCounter, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, ownedWindows, resizable, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, serialVersionUID, state, SW_RESIZE_CURSOR, TEXT_CURSOR, title, W_RESIZE_CURSOR, WAIT_CURSOR, weakThis
 
Fields inherited from class java.awt.Window
active, base, focusMgr, inputContext, nameCounter, OPENED, ownedWindowList, serialVersionUID, state, warningString, weakThis, windowListener, windowSerializedDataVersion
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, maxSize, ncomponents, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
(package private) PayoutGUI()
           
 
Method Summary
private  javax.swing.JPanel CreateInnerLabelPanel(java.lang.String label)
          Creates an inner JPanel containing a JLabel.
private  javax.swing.Box CreateOrdinarySuitHandBox()
          Creates the Box with all Ordinary Suit Hand details.
private  javax.swing.JPanel CreatePayoutPanel()
          Creates the JPanel which contain all information concerning the payout made to the winning wind.
 void CreatePayoutWindow(Set[] concealedSets, Set[] exposedSets)
          Creates the window containg all information concerning the Payout to the winner.
private  javax.swing.JPanel CreateScorePanel(Set[] concealedSets, Set[] exposedSets)
          Creates the window containg all information concerning the breakdown of scoring and the payouts for the winning player's hand.
private  javax.swing.Box CreateSpecialHandBox()
          Creates a Box containing all required special hand info.
private  javax.swing.JPanel CreateTablePanel(java.lang.String heading, java.lang.String[][] tableData, java.lang.String[] tableHeading)
          Creates a JPanel containing a JTable needed to display Payout and Scoring information.
private  javax.swing.JPanel drawConcHand(Tile[] concHand)
          Handles the drawing of a JPanel containing concealed Tiles.
private  javax.swing.JPanel drawTilePanel(Set[] tileArray, int max)
          Draws a JPanel containing ImageIcons for a given set of tiles.
 void IsSpecialHand(boolean isSpecHand)
          Sets whether of not the hand's a special hand.
 void setConcealedHand(Tile[] concealedHand)
          Sets the array of Tiles in the player's concealed hand.
 void setDoublesScoreInfo(java.lang.String[][] theDoublesScoreData, int theTotalNoOfDoubles)
          Sets information regarding doubles to the ground score of the hand.
 void setGameReference(Game theGameReference)
          Sets a reference to the Game object.
 void setGroundScoreInfo(java.lang.String[][] theGroundScoreData, int theTotalGroundScore)
          Sets the info required when displaying the ground score.
 void setPayoutInfo(java.lang.String[][] theLosersData, java.lang.String theWinnersName, java.lang.String theWinnersWind, int theTotalPayout)
          Sets the info required for displaying the payout information.
 void setScoringInfo(int theTotalScore, int theLimit)
          Sets the total score of the hand.
 void setSpecialHandInfo(java.lang.String theSpecialHandName, java.lang.String theSpecialHandDescription)
          Sets the info required for a special hand.
private  javax.swing.JScrollPane SpecialHandDescription()
          Creates the description of the special hand.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, createRootPaneException, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
, addNotify, addToFrameList, constructComponentName, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, initIDs, isResizable, postProcessKeyEvent, readObject, remove, removeFromFrameList, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle, writeObject
 
Methods inherited from class java.awt.Window
addOwnedWindow, addWindowListener, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, dispose, eventEnabled, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postWindowEvent, preProcessKeyEvent, processEvent, removeOwnedWindow, removeWindowListener, setFocusOwner, setWarningString, show, toBack, toFront, transferFocus
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyOrientation, countComponents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPrint, list, list, locate, minimumSize, paint, paintComponents, postsOldMouseEvents, preferredSize, print, printComponents, printOneComponent, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

PANEL_SEPARATION

private final int PANEL_SEPARATION
Defines the number of pixels separating panels contained in the JFrame.

IN_PANEL_SEPARATION

private final int IN_PANEL_SEPARATION
Defines the number of pixels separating items contained within panels panels.

TILE_SEPARATION

private final int TILE_SEPARATION
Defines the number of pixels separating the sets of tiles

groundScoreData

private java.lang.String[][] groundScoreData
Contains the data which is to be inserted into the JTable containing ground score information for an Ordinary Suit Hand.

totalGroundScore

private int totalGroundScore
Contains the total ground score for the winner's hand if they have an Ordinary Suit Hand.

doublesScoreData

private java.lang.String[][] doublesScoreData
Contains the double data for the doubles JTable if the winner has an Ordinary Suit Hand.

totalNoOfDoubles

private int totalNoOfDoubles
Contains the total number of doubles earnt for the winner's hand if they have an Ordinary Suit Hand).

specialHandName

private java.lang.String specialHandName
Holds the name of the special hand that the winner won with, if they have a special hand.

specialHandDescription

private java.lang.String specialHandDescription
Holds the description of the special hand the player won with if they have a special hand.

totalScore

private int totalScore
Holds the total score of the player's hand.

isSpecialHand

private boolean isSpecialHand
Indicates whether the player won with a special hand.

gameReference

private Game gameReference
A reference to the game in order to halt the game until the "OK" button of the Payout Window has been clicked.

handLimit

private int handLimit
The limit for a hand.

totalPayout

private int totalPayout
Total payout to the winner.

losingPlayersData

private java.lang.String[][] losingPlayersData
Contains the information concerning all losing players.

winnersName

private java.lang.String winnersName
Holds the winner's name.

winnersWind

private java.lang.String winnersWind
Holds the winner's wind.

concealedHand

private Tile[] concealedHand
Concealed Tiles from Special Hands set by the Game
Constructor Detail

PayoutGUI

PayoutGUI()
Method Detail

setConcealedHand

public void setConcealedHand(Tile[] concealedHand)
Sets the array of Tiles in the player's concealed hand.

CreatePayoutWindow

public void CreatePayoutWindow(Set[] concealedSets,
                               Set[] exposedSets)
Creates the window containg all information concerning the Payout to the winner. Includes both scoring and payout information.
Parameters:
concealedSets - The concealed sets of tiles the winner has in their hand.
exposedSets - The exposed sets of tiles the winner has in their hand.

CreatePayoutPanel

private javax.swing.JPanel CreatePayoutPanel()
Creates the JPanel which contain all information concerning the payout made to the winning wind.
Returns:
The Payout JPanel.

CreateScorePanel

private javax.swing.JPanel CreateScorePanel(Set[] concealedSets,
                                            Set[] exposedSets)
Creates the window containg all information concerning the breakdown of scoring and the payouts for the winning player's hand.
Parameters:
concealedSets - The concealed sets of tiles the winner has in their hand.
exposedSets - The exposed sets of tiles the winner has in their hand.
Returns:
The scoring JPanel.

CreateOrdinarySuitHandBox

private javax.swing.Box CreateOrdinarySuitHandBox()
Creates the Box with all Ordinary Suit Hand details.
Returns:
The Box of all ordinary suit hand details.

CreateSpecialHandBox

private javax.swing.Box CreateSpecialHandBox()
Creates a Box containing all required special hand info.
Returns:
A Box with all special hand info.

SpecialHandDescription

private javax.swing.JScrollPane SpecialHandDescription()
Creates the description of the special hand.
Returns:
Returns the JScrollPane containing the description of the special hand.

CreateTablePanel

private javax.swing.JPanel CreateTablePanel(java.lang.String heading,
                                            java.lang.String[][] tableData,
                                            java.lang.String[] tableHeading)
Creates a JPanel containing a JTable needed to display Payout and Scoring information.
Parameters:
heading - The heading of the inner JPanel to be returned.
tableData - The data to be contained within the table.
tableHeading - The heading of the JTable.

CreateInnerLabelPanel

private javax.swing.JPanel CreateInnerLabelPanel(java.lang.String label)
Creates an inner JPanel containing a JLabel.
Parameters:
The - JLabel to be added into the new JPanel.
Returns:
The inner JPanel containing the JLabel.

setPayoutInfo

public void setPayoutInfo(java.lang.String[][] theLosersData,
                          java.lang.String theWinnersName,
                          java.lang.String theWinnersWind,
                          int theTotalPayout)
Sets the info required for displaying the payout information.
Parameters:
theLosersData - Information concerning the payout from all losing player to the winner.
theWinnersName - The name of the winning player.
theWinnersWind - The wind of the winning player.

setGroundScoreInfo

public void setGroundScoreInfo(java.lang.String[][] theGroundScoreData,
                               int theTotalGroundScore)
Sets the info required when displaying the ground score.
Parameters:
theGroundScoreData - The data to be put into the ground score JTable.
theTotalGroundScore - The total ground score of the hand.

setDoublesScoreInfo

public void setDoublesScoreInfo(java.lang.String[][] theDoublesScoreData,
                                int theTotalNoOfDoubles)
Sets information regarding doubles to the ground score of the hand.
Parameters:
theDoublesScoreData - The data to be put into the doubles JPanel.
theTotalNoOfDoubles - The total number of doubles the player has earnt.

setSpecialHandInfo

public void setSpecialHandInfo(java.lang.String theSpecialHandName,
                               java.lang.String theSpecialHandDescription)
Sets the info required for a special hand.
Parameters:
theSpecialHandName - The name of the type of special hand.
theSpecialHandDescription - The description of the special hand.

IsSpecialHand

public void IsSpecialHand(boolean isSpecHand)
Sets whether of not the hand's a special hand.
Parameters:
isSpecHand - Indicates whether the hand's a special hand.

setScoringInfo

public void setScoringInfo(int theTotalScore,
                           int theLimit)
Sets the total score of the hand.
Parameters:
theTotalScore - The total score for the hand.

setGameReference

public void setGameReference(Game theGameReference)
Sets a reference to the Game object.
Parameters:
theGameReference - The reference to the Game object.

drawConcHand

private javax.swing.JPanel drawConcHand(Tile[] concHand)
Handles the drawing of a JPanel containing concealed Tiles. This method needs to be used when the player has a special hand that has been found by the Game class. These special hands contain an array of Tiles, not Sets. They are unique hands and as such can't be handled by the drawTilePanel method.
Parameters:
concHand - - An array of Tiles which the winner has in their concealed hand.

drawTilePanel

private javax.swing.JPanel drawTilePanel(Set[] tileArray,
                                         int max)
Draws a JPanel containing ImageIcons for a given set of tiles.
Parameters:
tileArray - An array of tiles.
max - The max elements that the tileArray can contain.
Returns:
The JPanel containing the Images of the given tiles.