|
||||||||||
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.bisim.view.GameView
public class GameView
The game view.
The game view consists of two LTS panels, left and right, a status panel below, and a chat and button panel above.
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 java.awt.Image |
loserImage
|
private javax.swing.ImageIcon |
loserImageIcon
|
private LTSPanel |
rightLTSPanel
A panel for the right LTS. |
private static long |
serialVersionUID
|
static java.lang.String |
STYLE_ACTION
|
static java.lang.String |
STYLE_COMMAND
|
static java.lang.String |
STYLE_GAMEOVER
|
static java.lang.String |
STYLE_STATE
|
static java.lang.String |
STYLE_STATUS
|
private javax.swing.JTextPane |
trace
A text pane inside the trace scroll pane. |
private java.awt.Dimension |
traceDimension
|
private javax.swing.JScrollPane |
traceScrollPane
A scroll pane for the trace. |
private int |
upperHeight
|
private GameViewUpperPanel |
upperPanel
The upper (north) panel of a game view. |
private int |
width
|
private java.awt.Image |
winnerImage
|
private javax.swing.ImageIcon |
winnerImageIcon
|
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 | |
---|---|
private void |
createImages()
Load gif images from the jar file. |
void |
createUpperPanel(int gameViewType)
Creates the lower panel of a game view, based on game options |
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. |
LTSPanel |
getLeftLTSPanel()
|
GameViewUpperPanel |
getLowerPanel()
|
LTSPanel |
getRightLTSPanel()
|
private void |
insertTraceStyles()
Generate the different styles used for writing in the trace text pane. |
void |
resetTrace()
Clear the text in the trace scroll pane. |
void |
updateTrace(java.lang.String message,
boolean doAutoScroll)
Update the trace with a message. |
void |
updateTrace(java.lang.String message,
boolean doAutoScroll,
java.lang.String styleName)
Update the trace with a styled message. |
private void |
updateTrace(java.lang.String message,
boolean doAutoScroll,
javax.swing.text.StyledDocument doc,
javax.swing.text.Style style)
|
void |
updateTrace(java.lang.String message,
java.lang.String styleName,
boolean winner)
Update the trace with a message and an icon (winner or loser). |
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 GameViewUpperPanel upperPanel
private javax.swing.JScrollPane traceScrollPane
private javax.swing.JTextPane trace
public static final java.lang.String STYLE_STATE
public static final java.lang.String STYLE_ACTION
public static final java.lang.String STYLE_COMMAND
public static final java.lang.String STYLE_STATUS
public static final java.lang.String STYLE_GAMEOVER
private java.awt.Image winnerImage
private java.awt.Image loserImage
private javax.swing.ImageIcon winnerImageIcon
private javax.swing.ImageIcon loserImageIcon
private java.awt.Dimension graphDimension
private java.awt.Dimension traceDimension
private int width
private int upperHeight
Constructor Detail |
---|
public GameView(int width, int height) throws javax.swing.text.BadLocationException
width
- Width of the main windowheight
- Height of the main window
javax.swing.text.BadLocationException
- Caused by using JTextPane. Should never be thrownMethod Detail |
---|
private void createImages()
public void createUpperPanel(int gameViewType)
gameViewType
- Type of game viewpublic void resetTrace() throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
- Caused by using JTextPane. Should never be thrownprivate void insertTraceStyles()
public 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 message, boolean doAutoScroll) throws javax.swing.text.BadLocationException
message
- A messagedoAutoScroll
- Whether or not to auto-scroll
javax.swing.text.BadLocationException
- Should never be thrownpublic void updateTrace(java.lang.String message, boolean doAutoScroll, java.lang.String styleName) throws javax.swing.text.BadLocationException
message
- A messagedoAutoScroll
- Whether or not to auto-scrollstyleName
- Name of the style to write in
javax.swing.text.BadLocationException
- Should never be thrownprivate void updateTrace(java.lang.String message, boolean doAutoScroll, javax.swing.text.StyledDocument doc, javax.swing.text.Style style) throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
public void updateTrace(java.lang.String message, java.lang.String styleName, boolean winner) throws javax.swing.text.BadLocationException
message
- A messagestyleName
- The style to write inwinner
- Whether or not to use the winner icon
javax.swing.text.BadLocationException
- Should never be thrownpublic GameViewUpperPanel getLowerPanel()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |