|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
dk.brics.bisimulationGame.view.GameView
public class GameView
The game view.
The game view consists of two LTS panels, left and right, a trace panel in between and a status panel below.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
GAME_VIEW_CLIENT
A client does not have a reset button. |
static int |
GAME_VIEW_LOCAL
A local game does not have a chat function. |
static int |
GAME_VIEW_SERVER
A server gets both a chat function and a reset button. |
private java.awt.Dimension |
graphDimension
|
private LTSPanel |
leftLTSPanel
A panel for the left LTS. |
private int |
lowerHeight
|
private GameViewLowerPanel |
lowerPanel
The lower (south) panel of a game view. |
private java.awt.Font |
messageFont
|
private LTSPanel |
rightLTSPanel
A panel for the right LTS. |
private static long |
serialVersionUID
|
private javax.swing.JTextArea |
trace
A text area inside the trace scroll pane. |
private java.awt.Dimension |
traceDimension
|
private javax.swing.JScrollPane |
traceScrollPane
A scroll pane for the trace. |
private int |
width
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
GameView(int width,
int height)
Constructs a game view but does not construct the lower panel. |
Method Summary | |
---|---|
void |
createLowerPanel(int gameViewType)
Creates the lower panel of a game view, based on game options |
void |
displayGameOver(java.lang.String message,
java.awt.Color color)
Display a game over message. |
void |
displayLTSs(att.grappa.Graph leftLTS,
att.grappa.Graph rightLTS,
att.grappa.GrappaAdapter ga)
Display the two LTSs. |
void |
displayLTSTitles(java.lang.String leftLTSTitle,
java.lang.String rightLTSTitle)
Display the titles of the two LTSs. |
void |
displayMessage(java.lang.String message)
Display a general message. |
private void |
displayRole(java.lang.String role)
Display a role message. |
void |
displayStatus(java.lang.String role,
java.lang.String turn,
java.lang.String message)
Display game status in the status part of the lower panel. |
void |
displayTurn(java.lang.String turn)
Display a turn message. |
LTSPanel |
getLeftLTSPanel()
|
GameViewLowerPanel |
getLowerPanel()
|
LTSPanel |
getRightLTSPanel()
|
void |
resetTrace()
Clear the text in the trace scroll pane |
void |
updateTrace(java.lang.String action)
Update the trace with the specified action. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getWidth, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
public static final int GAME_VIEW_LOCAL
public static final int GAME_VIEW_SERVER
public static final int GAME_VIEW_CLIENT
private LTSPanel leftLTSPanel
private LTSPanel rightLTSPanel
private javax.swing.JScrollPane traceScrollPane
private GameViewLowerPanel lowerPanel
private javax.swing.JTextArea trace
private java.awt.Dimension graphDimension
private java.awt.Dimension traceDimension
private int width
private int lowerHeight
private java.awt.Font messageFont
Constructor Detail |
---|
public GameView(int width, int height)
width
- Width of the main windowheight
- Height of the main windowMethod Detail |
---|
public void createLowerPanel(int gameViewType)
gameViewType
- Type of game viewpublic void resetTrace()
public void displayStatus(java.lang.String role, java.lang.String turn, java.lang.String message)
role
- A role messageturn
- A turn messagemessage
- A general messageprivate void displayRole(java.lang.String role)
role
- A role messagepublic void displayTurn(java.lang.String turn)
turn
- A turn messagepublic void displayMessage(java.lang.String message)
message
- A messagepublic void displayGameOver(java.lang.String message, java.awt.Color color)
message
- Message to displaycolor
- Color of the messagepublic void displayLTSTitles(java.lang.String leftLTSTitle, java.lang.String rightLTSTitle)
leftLTSTitle
- Title of the left LTSrightLTSTitle
- Title of the right LTSpublic void displayLTSs(att.grappa.Graph leftLTS, att.grappa.Graph rightLTS, att.grappa.GrappaAdapter ga)
leftLTS
- Left LTSrightLTS
- Right LTSga
- A Grappa adapterpublic LTSPanel getLeftLTSPanel()
public LTSPanel getRightLTSPanel()
public void updateTrace(java.lang.String action)
action
- An action namepublic GameViewLowerPanel getLowerPanel()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |