|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
org.jogre.client.awt.JogreTableFrame
The important JogreTableFrame which is where each game is played. Each time a new table is created one of these frames appear. This class creates the buttons at the top of the screen, the player list at the bottom left and the message chat box on the bottom right. The main game area is set in the sub classes e.g. ChessTableFrame using the setGamePanel (JPanel) method.
To use this class a class must extend it e.g. ChesTableFrame. Its fields must include a data model (JogreModel e.g. ChessModel), a view of the data (JogreComponent e.g. ChessBoardComponent) and a controller (JogreController e.g. ChessController) for understanding mouse movements etc on the view.
The constructor in the sub class should initialise these MVC fields and MUST call the setMVC (model, view, controller) method as this class makes use of these.
Nested Class Summary |
Nested classes inherited from class javax.swing.JFrame |
JFrame.AccessibleJFrame |
Nested classes inherited from class java.awt.Frame |
Frame.AccessibleAWTFrame |
Nested classes inherited from class java.awt.Window |
Window.AccessibleAWTWindow |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
protected TableConnectionThread |
conn
|
protected JogreController |
gameController
|
protected JogreComponent |
gameMainView
|
protected JogreModel |
gameModel
|
protected JogreButton |
inviteButton
|
protected ChatTableComponent |
messageComponent
|
protected JogreButton |
offerDrawButton
|
protected Player |
player
|
protected JogreButton |
resignButton
|
protected JogreButton |
sitButton
|
protected JogreButton |
standButton
|
protected JogreButton |
startButton
|
protected Table |
table
|
protected int |
tableNum
|
protected String |
username
|
Fields inherited from class javax.swing.JFrame |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, PROPERTIES, SOMEBITS |
Constructor Summary | |
JogreTableFrame(TableConnectionThread conn)
Constructor which doesn't take a width and height. |
|
JogreTableFrame(TableConnectionThread conn,
int width,
int height)
Constructor to a standard JogreGameFrame. |
Method Summary | |
void |
addToTopPanel(Component component)
Method to add additional components (such as buttons etc) to the top right hand side of the screen. |
JogreController |
getController()
Accessor for the game controller. |
JogreInviteDialog |
getInviteDialog()
Get invite dialog |
ChatGameComponent |
getMessageComponent()
Accessor for the small message box with each table. |
JogreModel |
getModel()
Accessor for the game controller. |
void |
leaveTable()
Player leaves the table. |
protected void |
receiveMessage(XMLElement message)
Adapter method for receiving a custom message. |
void |
receiveTableMessage(XMLElement message)
Implementation of the ITable interface. |
void |
setGamePanel(JogrePanel gamePanel)
Set the empty panel in the screen equal to the game panel. |
void |
setTableFramesHash(HashMap tableFramesHash)
Set the link to the table frames hash in the JogreClientFrame (must be deleted when the client is removed). |
void |
setupMVC(JogreModel model,
JogreComponent mainView,
JogreController controller)
Sets up the MVC for this table. |
void |
startGame()
Start the game (Empty adapter method). |
void |
update(Observable obs,
Object obj)
Update and refresh the buttons when the data changes. |
Methods inherited from class java.awt.Frame |
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
Field Detail |
protected String username
protected TableConnectionThread conn
protected int tableNum
protected JogreModel gameModel
protected JogreController gameController
protected JogreComponent gameMainView
protected Table table
protected Player player
protected ChatTableComponent messageComponent
protected JogreButton sitButton
protected JogreButton standButton
protected JogreButton startButton
protected JogreButton offerDrawButton
protected JogreButton resignButton
protected JogreButton inviteButton
Constructor Detail |
public JogreTableFrame(TableConnectionThread conn, int width, int height)
conn
- Client connection thread which holds the link to the
server, user and table lists.width
- Width of the table frame.height
- Height of the table frame.public JogreTableFrame(TableConnectionThread conn)
conn
- Table connection thread.Method Detail |
public void setTableFramesHash(HashMap tableFramesHash)
tableFramesHash
- public void leaveTable()
public void setGamePanel(JogrePanel gamePanel)
gamePanel
- public void addToTopPanel(Component component)
component
- public JogreController getController()
public JogreModel getModel()
public ChatGameComponent getMessageComponent()
public JogreInviteDialog getInviteDialog()
public void receiveTableMessage(XMLElement message)
receiveTableMessage
in interface ITable
message
- Message from server.ITable.receiveTableMessage(nanoxml.XMLElement)
protected void receiveMessage(XMLElement message)
ITable.receiveTableMessage(nanoxml.XMLElement)
public void startGame()
public void setupMVC(JogreModel model, JogreComponent mainView, JogreController controller)
model
- mainView
- controller
- public void update(Observable obs, Object obj)
update
in interface Observer
Observer.update(java.util.Observable, java.lang.Object)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |