Class games.Battle.client.EuropaClient.EuropaClient
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class games.Battle.client.EuropaClient.EuropaClient

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----games.Battle.client.EuropaClient.EuropaClient

public class EuropaClient
extends Applet
implements Runnable
EuropaClient is the main applet for the "lobby" of the Europa game. Sets up the game queue graphics, the who-list and the chat window. This applet also initiates conversations with the game server, logs users in, and spawns game board clients when the server instructs it that a game is about to begin.

Variable Index

 o gameId
The game id, if a game is executing (-1 otherwise).

Constructor Index

 o EuropaClient(Frame)
Construct an EuropaClient window, and set an internal reference to an encapsulating frame.
 o EuropaClient()
Construct a EuropaClient instance free from the bonds of a frame window.

Method Index

 o changeInfo()
Creates a dialog box allowing the user to change his or her user information.
 o getGameId()
Return the currently executing game Id, -1 if there is no game in progress.
 o init()
Performs a list of inititialization routines, including contacting the game server, and building all of the components which are inside the EuropaClient (including the various game queues and the who list)
 o join(int)
Sends a request to the server to join the given game.
 o main(String[])
The main routine for an applet-less execution.
 o quit()
Quits this applet, cleaning up any lingering windows and informing the server that we are quitting.
 o readChat(int)
Read numlines of chat window messages from the server and display them in the chat window (if the chat window exists).
 o readGames(int)
Read all of the game information from the server, and use the information to properly update the contents of the game queue window.
 o readWho(int)
Read numplayers WhoInfo packets from the server and display them in the who list.
 o resume()
Resumes this applet's main thread.
 o run()
The main execution loop for this applet's thread.
 o sendChat(String)
Sends the given chat message to the server.
 o setPlayerInfo(PlayerInfo)
Sends PlayerInfo information to the server so the server can save the info for future reference.
 o shutdownServer()
Sends a message to the server to shut itself down.
 o start()
Starts up the applet thread of execution.
 o stop()
Overloaded stop method to do nothing.
 o suspend()
Suspends this applet's main thread.
 o toggleChatWindow()
Turns the chat window on if it is off, and off if it is on.

Variables

 o gameId
  public int gameId
The game id, if a game is executing (-1 otherwise).

Constructors

 o EuropaClient
  public EuropaClient(Frame f)
Construct an EuropaClient window, and set an internal reference to an encapsulating frame.
Parameters:
f - the frame window
 o EuropaClient
  public EuropaClient()
Construct a EuropaClient instance free from the bonds of a frame window.

Methods

 o init
  public void init()
Performs a list of inititialization routines, including contacting the game server, and building all of the components which are inside the EuropaClient (including the various game queues and the who list)
Overrides:
init in class Applet
 o setPlayerInfo
  public void setPlayerInfo(PlayerInfo r)
Sends PlayerInfo information to the server so the server can save the info for future reference.
Parameters:
r - the PlayerInfo instance
See Also:
PlayerInfo
 o start
  public void start()
Starts up the applet thread of execution. This includes: a) trying to log into the game, b) registering this player (based on their login id) with the server. If all is successful, then the run() method is called to start the game, otherwise the applet execution ends.
Overrides:
start in class Applet
 o stop
  public void stop()
Overloaded stop method to do nothing.
Overrides:
stop in class Applet
 o readGames
  public void readGames(int numGames) throws IOException
Read all of the game information from the server, and use the information to properly update the contents of the game queue window. This method is also responsible for recognizing when a game queue has been successfull filled and starting the game clients.
Parameters:
numGames - the number of games to read from the server
 o readWho
  public void readWho(int numplayers) throws IOException
Read numplayers WhoInfo packets from the server and display them in the who list.
Parameters:
numplayers - the number of players to read
 o readChat
  public void readChat(int numlines) throws IOException
Read numlines of chat window messages from the server and display them in the chat window (if the chat window exists).
Parameters:
numlines - the number of lines to read
 o run
  public void run()
The main execution loop for this applet's thread. The thread basically waits for input from the server and updates the contents of all of the info window when information is received.
 o join
  public void join(int game) throws IOException
Sends a request to the server to join the given game.
Parameters:
game - the game to join
 o getGameId
  public int getGameId()
Return the currently executing game Id, -1 if there is no game in progress.
 o suspend
  public void suspend()
Suspends this applet's main thread.
 o resume
  public void resume()
Resumes this applet's main thread.
 o quit
  public void quit()
Quits this applet, cleaning up any lingering windows and informing the server that we are quitting.
 o shutdownServer
  public void shutdownServer()
Sends a message to the server to shut itself down. This method is really only accessible by wizards from their display consoles.
 o changeInfo
  public void changeInfo()
Creates a dialog box allowing the user to change his or her user information.
 o toggleChatWindow
  public void toggleChatWindow()
Turns the chat window on if it is off, and off if it is on.
 o sendChat
  public void sendChat(String msg)
Sends the given chat message to the server.
Parameters:
msg - the message to send to the server
 o main
  public static void main(String argv[])
The main routine for an applet-less execution.

All Packages  Class Hierarchy  This Package  Previous  Next  Index