public final class GuiBoard extends javax.swing.JPanel implements ConstGuiBoard, java.awt.print.Printable
Modifier and Type | Class and Description |
---|---|
static interface |
GuiBoard.Listener
Callback for clicks on a field.
|
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
GuiBoard(int size)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clearAll()
Clear every kind of markup.
|
void |
clearAllCrossHair()
Clear all crosshairs.
|
void |
clearAllGhostStones()
Clear all shadow stones.
|
void |
clearAllInfluence() |
void |
clearAllLabels()
Clear all labels.
|
void |
clearAllMarkup()
Clear all markup.
|
void |
clearAllSelect()
Clear all selected points.
|
void |
clearAllTerritory()
Clear all territory.
|
void |
clearInfluence(GoPoint point)
Clear influence.
|
void |
contextMenu(GoPoint point)
Trigger the context menu callback at the listener.
|
int |
getBoardSize()
Get current board size.
|
ConstField |
getFieldConst(GoPoint p)
Return a field.
|
java.awt.Dimension |
getFieldSize() |
java.lang.String |
getLabel(GoPoint point)
Get label.
|
java.awt.Point |
getLocationOnScreen(GoPoint point)
Get location on screen for a point.
|
boolean |
getMark(GoPoint point)
Check if point is marked.
|
boolean |
getMarkCircle(GoPoint point)
Check if point is marked with a circle.
|
boolean |
getMarkSquare(GoPoint point)
Check if point is marked with a square.
|
boolean |
getMarkTriangle(GoPoint point)
Check if point is marked with a triangle.
|
java.awt.Dimension |
getMinimumFieldSize() |
java.awt.Dimension |
getPreferredFieldSize() |
boolean |
getSelect(GoPoint point)
Check if point is selected.
|
boolean |
getShowCursor()
Check if cursor is shown.
|
boolean |
getShowGrid() |
void |
initSize(int size)
Change the board size.
|
void |
markLastMove(GoPoint point)
Mark point of last move on the board.
|
void |
paintImmediately(GoPoint point) |
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat format,
int page) |
void |
setColor(GoPoint point,
GoColor color)
Set or remove stone.
|
void |
setCrossHair(GoPoint point,
boolean crossHair)
Set crosshair.
|
void |
setCursor(GoPoint point)
Set the cursor.
|
void |
setFieldBackground(GoPoint point,
java.awt.Color color)
Set the field background color.
|
void |
setGhostStone(GoPoint point,
GoColor color) |
void |
setInfluence(GoPoint point,
double value)
Set influence value.
|
void |
setLabel(GoPoint point,
java.lang.String label)
Set label.
|
void |
setListener(GuiBoard.Listener listener)
Set the listener.
|
void |
setMark(GoPoint point,
boolean mark)
Set markup.
|
void |
setMarkCircle(GoPoint point,
boolean mark)
Set circle markup.
|
void |
setMarkSquare(GoPoint point,
boolean mark)
Set square markup.
|
void |
setMarkTriangle(GoPoint point,
boolean mark)
Set triangle markup.
|
void |
setPreferredFieldSize(java.awt.Dimension size) |
void |
setSelect(GoPoint point,
boolean select)
Set point selection markup.
|
void |
setShowCursor(boolean showCursor)
Enable or disable cursor.
|
void |
setShowGrid(boolean showGrid)
Enable or disable grid coordinates.
|
void |
setTerritory(GoPoint point,
GoColor color)
Set territory.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getWidth
public GuiBoard(int size)
size
- The board size.public void clearAll()
public void clearAllCrossHair()
public void clearAllInfluence()
public void clearAllMarkup()
public void clearAllSelect()
public void clearAllLabels()
public void clearAllGhostStones()
public void clearAllTerritory()
public void clearInfluence(GoPoint point)
public void contextMenu(GoPoint point)
public int getBoardSize()
getBoardSize
in interface ConstGuiBoard
public ConstField getFieldConst(GoPoint p)
getFieldConst
in interface ConstGuiBoard
public java.awt.Dimension getFieldSize()
getFieldSize
in interface ConstGuiBoard
public java.lang.String getLabel(GoPoint point)
getLabel
in interface ConstGuiBoard
point
- The point.public java.awt.Point getLocationOnScreen(GoPoint point)
getLocationOnScreen
in interface ConstGuiBoard
point
- The point.public boolean getMark(GoPoint point)
getMark
in interface ConstGuiBoard
point
- The point.public boolean getMarkCircle(GoPoint point)
getMarkCircle
in interface ConstGuiBoard
point
- The point.public boolean getMarkSquare(GoPoint point)
getMarkSquare
in interface ConstGuiBoard
point
- The point.public boolean getMarkTriangle(GoPoint point)
getMarkTriangle
in interface ConstGuiBoard
point
- The point.public java.awt.Dimension getMinimumFieldSize()
public java.awt.Dimension getPreferredFieldSize()
public boolean getSelect(GoPoint point)
getSelect
in interface ConstGuiBoard
point
- The point.public boolean getShowCursor()
getShowCursor
in interface ConstGuiBoard
public boolean getShowGrid()
getShowGrid
in interface ConstGuiBoard
public void initSize(int size)
size
- The new board size.public void markLastMove(GoPoint point)
public void paintImmediately(GoPoint point)
public int print(java.awt.Graphics g, java.awt.print.PageFormat format, int page) throws java.awt.print.PrinterException
print
in interface java.awt.print.Printable
java.awt.print.PrinterException
public void setColor(GoPoint point, GoColor color)
point
- The point.color
- The stone color or EMPTY to remove a stone,
if existing.public void setCursor(GoPoint point)
point
- New location of the cursor.public void setFieldBackground(GoPoint point, java.awt.Color color)
point
- The location of the field.color
- The color.public void setCrossHair(GoPoint point, boolean crossHair)
point
- The point.crossHair
- True to set, false to remove crosshair.public void setInfluence(GoPoint point, double value)
point
- The point.value
- The influence value between -1 and 1.public void setLabel(GoPoint point, java.lang.String label)
point
- The point.label
- The label. Should not be longer than 3 characters to
avoid clipping. null to remove label.public void setListener(GuiBoard.Listener listener)
listener
- The new listener; null to set no listener.public void setMark(GoPoint point, boolean mark)
point
- The point.mark
- True to set, false to remove.public void setMarkCircle(GoPoint point, boolean mark)
point
- The point.mark
- True to set, false to remove.public void setMarkSquare(GoPoint point, boolean mark)
point
- The point.mark
- True to set, false to remove.public void setMarkTriangle(GoPoint point, boolean mark)
point
- The point.mark
- True to set, false to remove.public void setPreferredFieldSize(java.awt.Dimension size)
public void setSelect(GoPoint point, boolean select)
point
- The point.select
- True to set, false to remove.public void setShowCursor(boolean showCursor)
showCursor
- true to enable cursor.public void setShowGrid(boolean showGrid)
showGrid
- true to enable grid coordinates.