Serialized Form
port
int port
- The TCP port of the server.
localPlayerName
java.lang.String localPlayerName
- The name of the local player.
host
java.lang.String host
- The IP address of the server.
isAnApplet
boolean isAnApplet
- Indicates whether the GameClient is running as an applet or as an application.
mainArgs
java.lang.String[] mainArgs
- Contains the command-line arguments passed to the GameClient in case it was run as an application.
connection
GameClientConnection connection
- The connection to the server.
gameScreen
GameClient.GameScreen gameScreen
- The game screen.
startScreen
GameClient.StartScreen startScreen
- The start screen.
this$0
GameClient this$0
ON_NEW_GAME_BUTTON_CLICK
java.awt.event.ActionListener ON_NEW_GAME_BUTTON_CLICK
- The event handler for the "New game" button. Asks the player for confirmation and, if confirmed, sends a request for a new game to the remote player.
ON_SURRENDER_GAME_BUTTON_CLICK
java.awt.event.ActionListener ON_SURRENDER_GAME_BUTTON_CLICK
- The event handler for the "Surrender" button. Asks the player for confirmation and, if confirmed, changes the interface accordingly and informs the remote player.
ON_WAIT_FOR_NEW_PLAYER_BUTTON_CLICK
java.awt.event.ActionListener ON_WAIT_FOR_NEW_PLAYER_BUTTON_CLICK
- The event handler for the "Wait for new player" button. Asks the player for confirmation and, if confirmed, drops the remote player, if any, and sets the interface accordingly to wait for a new player.
ON_QUIT_TO_START_SCREEN_BUTTON_CLICK
java.awt.event.ActionListener ON_QUIT_TO_START_SCREEN_BUTTON_CLICK
- The event handler for the "Return to start screen" button. Asks the player for confirmation and, if confirmed, informs the server and brings up a StartScreen.
ON_QUIT_GAME_BUTTON_CLICK
java.awt.event.ActionListener ON_QUIT_GAME_BUTTON_CLICK
- The event handler for the "Quit game" button. Asks the user for confirmation and, if confirmed, calls terminate() from GameScreen.
ON_SEND_MESSAGE_BUTTON_CLICK
java.awt.event.ActionListener ON_SEND_MESSAGE_BUTTON_CLICK
- The event handler for the "Send" button. Sends the entered message to the remote player and adds it to messageArea.
ON_CLEAR_MESSAGE_AREA_BUTTON_CLICK
java.awt.event.ActionListener ON_CLEAR_MESSAGE_AREA_BUTTON_CLICK
- The event handler for the "Clear" button. Clears messageArea.
ON_SHOW_LOCAL_PLAYER_LAST_MOVE_CHECK_BOX_CLICK
java.awt.event.ItemListener ON_SHOW_LOCAL_PLAYER_LAST_MOVE_CHECK_BOX_CLICK
- The event handler for the "Show my last move" checkbox. Calls setLocalPlayerLastSquareHighlighted(boolean) from GameField.
ON_SHOW_REMOTE_PLAYER_LAST_MOVE_CHECK_BOX_CLICK
java.awt.event.ItemListener ON_SHOW_REMOTE_PLAYER_LAST_MOVE_CHECK_BOX_CLICK
- The event handler for the "Show remote player's last move" checkbox. Calls setRemotePlayerLastSquareHighlighted(boolean) from GameField.
isConnectedToAPlayer
boolean isConnectedToAPlayer
- True if the player is connected to a remote player; false otherwise.
isGameRunning
boolean isGameRunning
- True if a game is running; false otherwise.
isLocalPlayerMove
boolean isLocalPlayerMove
- True if it's the local player's turn; false otherwise.
isRequestingForANewGame
boolean isRequestingForANewGame
- True if the local player has sent a request for a new game to the remote player; false otherwise.
monitor
GameClient.GameScreen.Monitor monitor
- Handles local player moves and updates the time counts.
allButtons
javax.swing.JButton[] allButtons
- References all the buttons.
gameRunningButtons
javax.swing.JButton[] gameRunningButtons
- References buttons that are enabled only when a game is running.
gameStateButtons
javax.swing.JButton[] gameStateButtons
- References buttons that are grouped together.
playerExistsButtons
javax.swing.JButton[] playerExistsButtons
- References buttons that are enabled only when a remote player is present.
overallTimeLabel
javax.swing.JLabel overallTimeLabel
- Shows the duration of the game in progress or of the previous game if a new one has not been started yet.
localPlayerNameLabel
javax.swing.JLabel localPlayerNameLabel
- Shows the name of the local player.
localPlayerOverallTimeLabel
javax.swing.JLabel localPlayerOverallTimeLabel
- Shows the duration of the local player's moves during the current game or the previous game if a new game has not been started yet.
localPlayerCurrentTimeLabel
javax.swing.JLabel localPlayerCurrentTimeLabel
- Shows the duration of the local player's current turn or of the previous turn if it is not the local player's turn.
localPlayerScoreLabel
javax.swing.JLabel localPlayerScoreLabel
- Shows the score of the local player.
remotePlayerNameLabel
javax.swing.JLabel remotePlayerNameLabel
- Shows the name of the remote player or "(NO PLAYER)" if no remote player has not joined yet or, if the remote player quit, the name of the remote player plus " (QUIT)".
remotePlayerOverallTimeLabel
javax.swing.JLabel remotePlayerOverallTimeLabel
- Shows the duration of the remote player's moves during the current game or the previous game if a new game has not been started yet.
remotePlayerCurrentTimeLabel
javax.swing.JLabel remotePlayerCurrentTimeLabel
- Shows the duration of the remote player's current turn or of the previous turn if it is not the remote player's turn.
remotePlayerScoreLabel
javax.swing.JLabel remotePlayerScoreLabel
- Shows the score of the remote player.
enterMessageFieldLabel
javax.swing.JLabel enterMessageFieldLabel
- The label for enterMessageField.
localPlayerIcon
javax.swing.JLabel localPlayerIcon
- Holds the icon for the local player. The icon contains the symbol the local player makes (a cross or a circle) and is highlighted during the local player's turn.
remotePlayerIcon
javax.swing.JLabel remotePlayerIcon
- Holds the icon for the remote player. The icon contains the symbol the remote player makes (a cross or a circle) and is highlighted during the remote player's turn.
playerNameLabels
javax.swing.JLabel[] playerNameLabels
- References labels that show the names of the players.
playerScoreLabels
javax.swing.JLabel[] playerScoreLabels
- References labels that show the scores of the players.
playerTimeLabels
javax.swing.JLabel[] playerTimeLabels
- References labels that show the times of the players.
localPlayerLabels
javax.swing.JLabel[] localPlayerLabels
- References labels that hold information about the local player.
remotePlayerLabels
javax.swing.JLabel[] remotePlayerLabels
- References labels that hold information about the remote player.
BUTTON_ACTION_LISTENERS
java.awt.event.ActionListener[] BUTTON_ACTION_LISTENERS
- References ActionListeners that will be set to the buttons.
CHECK_BOX_ITEM_LISTENERS
java.awt.event.ItemListener[] CHECK_BOX_ITEM_LISTENERS
- References ItemListeners that will be set to the checkboxes.
gameField
GameField gameField
- The gamefield.
remotePlayerScore
int remotePlayerScore
- The score of the remote player.
localPlayerScore
int localPlayerScore
- The score of the local player.
remotePlayerName
java.lang.String remotePlayerName
- The name of the remote player.
messageArea
javax.swing.JTextArea messageArea
- Holds the messages that have been sent between the players.
enterMessageField
javax.swing.JTextField enterMessageField
- Accepts a message that can be sent to the remote player.
checkBoxes
javax.swing.JCheckBox[] checkBoxes
- References all the checkboxes.
timeFormatter
java.text.SimpleDateFormat timeFormatter
- Is used to convert a time in milliseconds into a HH:mm:ss format.
localPlayerImageIcon
javax.swing.ImageIcon localPlayerImageIcon
- The icon contains the symbol the local player makes (a cross or a circle).
localPlayerHighlightedImageIcon
javax.swing.ImageIcon localPlayerHighlightedImageIcon
- The icon contains the highlighted version of the symbol the local player makes (a cross or a circle).
remotePlayerImageIcon
javax.swing.ImageIcon remotePlayerImageIcon
- The icon contains the symbol the remote player makes (a cross or a circle).
remotePlayerHighlightedImageIcon
javax.swing.ImageIcon remotePlayerHighlightedImageIcon
- The icon contains the highlighted version of the symbol the remote player makes (a cross or a circle).
this$0
GameClient this$0
playerNamesListModel
javax.swing.DefaultListModel playerNamesListModel
- Represents the contents of playerNamesList.
playerNamesList
javax.swing.JList playerNamesList
- Is used to show the names of the players that can be joined. Gets its contents from playerNamesListModel.
enterNameField
javax.swing.JTextField enterNameField
- Is used by the player to enter his/her name.
enterNameFieldLabel
javax.swing.JLabel enterNameFieldLabel
- The label for enterNameField.
pictureAndCopyrightLabel
javax.swing.JLabel pictureAndCopyrightLabel
- The label that holds a picture and a copyright notice.
informationLabel
javax.swing.JLabel informationLabel
- The label that holds information about the game.
allButtons
javax.swing.JButton[] allButtons
- References all the buttons.
localPlayerNameToBeValidated
java.lang.String localPlayerNameToBeValidated
- Is used to temporarily hold the entered player name that has been sent to the server for validation and registration.
remotePlayerNameToBeJoined
java.lang.String remotePlayerNameToBeJoined
- Is used to temporarily hold the name of the remote player the local player wanted to join
componentIsEnabled
boolean[] componentIsEnabled
- Is used by setNeededComponentsEnabled(boolean) to save and load the state of the components that need to be enabled or disabled.
ON_ACCEPT_NAME_BUTTON_CLICK
java.awt.event.ActionListener ON_ACCEPT_NAME_BUTTON_CLICK
- The event handler for the "Accept name" button. Sends the entered player name to the server for validation and sets certain elements of the interface disabled to disallow the player to enter a new name while the previous name is still being validated.
ON_CREATE_GAME_BUTTON_CLICK
java.awt.event.ActionListener ON_CREATE_GAME_BUTTON_CLICK
- The event handler for the "Create game" button. Asks the player for a symbol to be drawn (cross or circle) and brings up a GameScreen.
ON_JOIN_GAME_BUTTON_CLICK
java.awt.event.ActionListener ON_JOIN_GAME_BUTTON_CLICK
- The event handler for the "Join game" button. Sends a join request to the server and sets certain elements of the interface disabled to disallow the player to create or join a game while the previous join request is still being handled.
ON_QUIT_GAME_BUTTON_CLICK
java.awt.event.ActionListener ON_QUIT_GAME_BUTTON_CLICK
- The event handler for the "Quit game" button. Calls terminate() from GameClient.
ON_PLAYER_NAMES_LIST_CLICK
javax.swing.event.ListSelectionListener ON_PLAYER_NAMES_LIST_CLICK
- The event handler for a selection value change on playerNamesList. If a value was selected in the playerNamesList, then the "Join game" button is enabled if the user has entered a name. If a value was deselected in the playerNamesList, then the "Join game" button is disabled.
ON_PLAYER_NAMES_LIST_DOUBLE_CLICK
java.awt.event.MouseListener ON_PLAYER_NAMES_LIST_DOUBLE_CLICK
- The event handler for a double-click on playerNamesList. Calls doClick() from the "Join game" button.
ON_PLAYER_NAMES_LIST_PRESS_ENTER
java.awt.event.KeyListener ON_PLAYER_NAMES_LIST_PRESS_ENTER
- The event handler for a keypress on playerNamesList. If the pressed key was enter, then doClick() from the "Join game" button is called.
BUTTON_ACTION_LISTENERS
java.awt.event.ActionListener[] BUTTON_ACTION_LISTENERS
- References the ActionListeners for all the buttons.
isDrawingCircles
boolean isDrawingCircles
- Is true if the local player is drawing circles; is false if the local player is drawing crosses.
isChanged
boolean isChanged
- Is true if the local player has made a move and the isChanged() method has not been called yet; is false otherwise.
isFinished
boolean isFinished
- Is true if the local player has made a winning move; is false otherwise.
isLocalPlayerMove
boolean isLocalPlayerMove
- Is true if the local player can make a move; is false otherwise.
isLocalPlayerLastMoveHighlighted
boolean isLocalPlayerLastMoveHighlighted
- Is true if the local player's last move is to be highlighted; is false otherwise.
isRemotePlayerLastMoveHighlighted
boolean isRemotePlayerLastMoveHighlighted
- Is true if the remote player's last move is to be highlighted; is false otherwise.
localPlayerLastMove
int[] localPlayerLastMove
- Holds the coordinates of the last move by the local player.
remotePlayerLastMove
int[] remotePlayerLastMove
- Holds the coordinates of the last move by the remote player.
winningSquares
int[][] winningSquares
- Holds the winning squares if a winning move has been made.
gameField
GameSquare[][] gameField
- The gamefield.
ON_GAME_SQUARE_CLICK
java.awt.event.ActionListener ON_GAME_SQUARE_CLICK
- The ActionListener for all the GameSquares.
isCrossed
boolean isCrossed
- Is true if the square is crossed, is false otherwise.
isCircled
boolean isCircled
- Is true if the square is circled, is false otherwise.
isWinningSquare
boolean isWinningSquare
- Is true if the square has been circled or crossed and is part of a winning row. Is used in setHighlighted(boolean) - a winning square is not unhighlighted.
position
int[] position
- The position of the square on the gamefield.