|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.event.WindowAdapter
GUI
public class GUI
The GUI class contains all the Swing components that comprise the SARJ Graphical User Interface
| Field Summary | |
|---|---|
static boolean |
STATE_CONNECTED
|
static boolean |
STATE_DISCONNECTED
|
| Constructor Summary | |
|---|---|
GUI(java.lang.String configFilePath,
GUIListener listener)
Creates a new GUI object. |
|
| Method Summary | |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Called as a result of implementing ActionListener |
void |
addPlayer(java.lang.String name,
int score,
int deaths,
java.lang.String ratio,
int ping,
int team,
java.lang.String ip,
int num)
Adds details of a player to the player table. |
void |
addQuickButton(java.lang.String name,
java.lang.String command)
Adds a new button to the QuickButton panel |
void |
addTeam(java.lang.String name,
int score,
int kills,
int deaths,
int ping)
Adds details of a team to the team table. |
void |
clearConsole()
Clears the connection console |
void |
clearPlayerTable()
Clears the table containing the list of currently connected players |
void |
clearTeamTable()
Clears the table containing details of each team |
void |
connected()
Updates the GUI components to show that the user is connected. |
void |
disconnected()
Updates the GUI components to show that the user is disconnected. |
java.lang.String |
getIPField()
Returns the current value stored in the IP address field on the main window |
javax.swing.JFrame |
getMainFrame()
Returns the GUI's main window frame |
java.lang.String |
getPasswordField()
Returns the current value stored in the password field on the main window |
java.lang.String |
getPortField()
Returns the current value stored in the port field on the main window |
QuickButton[] |
getQuickButtons()
Returns the buttons on the QuickButton panel |
void |
hide()
Hide the GUI |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
removeQuickButton(java.lang.String name)
Removes a button from the QuickButton panel |
void |
setAutoRefresh(boolean refresh)
Sets the automatic refresh timer to on or off |
void |
setGameType(java.lang.String gameType)
Sets the game type label on the main window to the one specified |
void |
setIPField(java.lang.String ip)
Sets the server address text field on the main window to the one specified |
void |
setMapName(java.lang.String mapName)
Sets the map name label on the main window to the one specified |
void |
setPortField(java.lang.String port)
Sets the port number text field on the main window to the one specified |
void |
setRefreshDelay(int delay)
Sets the delay of the refresh timer for refreshing the player details |
void |
setScoreLimit(java.lang.String limit)
Sets the score limit label on the main window to the one specified |
void |
setTitle(java.lang.String title)
Sets the window title of the GUI |
void |
show()
Display the GUI |
void |
startRefreshTimer(int delay)
Starts the automatic refresh timer with the specified millisecond delay |
void |
stopRefreshTimer()
Stops the automatic refresh timer |
void |
windowClosing(java.awt.event.WindowEvent e)
Called when the main window is being closed |
void |
writeToConsole(java.lang.String text)
Writes the specified string of text to the main console |
| Methods inherited from class java.awt.event.WindowAdapter |
|---|
windowActivated, windowClosed, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final boolean STATE_CONNECTED
public static final boolean STATE_DISCONNECTED
| Constructor Detail |
|---|
public GUI(java.lang.String configFilePath,
GUIListener listener)
configFilePath - the path of the SARJ configuration file
(e.g. config.txt)listener - the object to receive events generated by the GUI| Method Detail |
|---|
public void show()
public void hide()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenere - the object containing details of the eventpublic void setRefreshDelay(int delay)
delay - the time to delay, in millisecondspublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void setTitle(java.lang.String title)
title - the name of the new title for the windowpublic void setIPField(java.lang.String ip)
ip - the server address to set the text field topublic void setPortField(java.lang.String port)
port - the port number to set the text field topublic void setAutoRefresh(boolean refresh)
refresh - true or false to set the timer to on or off, respectivelypublic void setMapName(java.lang.String mapName)
mapName - the name of the map to set the field topublic void setGameType(java.lang.String gameType)
gameType - the name of the game type to set the field to
(e.g. Deathmatch, CTF, etc)public void setScoreLimit(java.lang.String limit)
limit - the score limit to set the field topublic void clearConsole()
public void clearPlayerTable()
public void clearTeamTable()
public void addPlayer(java.lang.String name,
int score,
int deaths,
java.lang.String ratio,
int ping,
int team,
java.lang.String ip,
int num)
name - the name of the playerscore - the player's scoredeaths - the player's number of deathsratio - the player's kill-to-death ratio (Infinity should be
represented as '*'ping - the player's pingteam - the player's current team number, where 1 = alpha, 2 = beta,
3 = charlie and 4 = deltaip - the player's IP addressnum - the player's unique in-game ID, as assigned by the serverclearPlayerTable()
public void addTeam(java.lang.String name,
int score,
int kills,
int deaths,
int ping)
name - the name of the team (e.g. Alpha, Beta, Charlie, Delta)score - the team's total scorekills - the total number of kills made by players on the teamdeaths - the total number of deaths made by the players on the teamping - the average player ping of the teampublic javax.swing.JFrame getMainFrame()
public java.lang.String getIPField()
public java.lang.String getPortField()
public java.lang.String getPasswordField()
public void windowClosing(java.awt.event.WindowEvent e)
windowClosing in interface java.awt.event.WindowListenerwindowClosing in class java.awt.event.WindowAdaptere - the object containing data of the activating window eventpublic void writeToConsole(java.lang.String text)
text - the string of text to be printedpublic void startRefreshTimer(int delay)
delay - the timer delay, in millisecondspublic void stopRefreshTimer()
public void connected()
public void disconnected()
public void addQuickButton(java.lang.String name,
java.lang.String command)
name - the name of the button. This will also appear as the button
captioncommand - the command string associated with the button, to be
executed when it is activatedpublic void removeQuickButton(java.lang.String name)
name - the name of the button to remove (the caption of the button)public QuickButton[] getQuickButtons()
QuickButton objects currently on the panel
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||