|
|||||||||||
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
gecco.client.Board
The board is what is displayed to the user of the game. It paints the map and the pieces. The board needs to know of a Game object, whose pieces are to be painted on the board.
The board contains scrollbars used for scrolling when the map does not fit the screen. It also contain zoom buttons for zooming in or out on the board. The zoom buttons use some gif images in the icons catalog (zoomin.gif and zoomout.gif).
All painting is done in an offscreen buffer and is then copied to the screen. Use method repaintBoard, to repaint the board to reflect changes in the game.
Nested Class Summary |
Nested classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
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 |
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 | |
Board(Game game)
|
Method Summary | |
void |
addBoardMouseListener(MouseListener ml)
Adds the given mouse listener the the area where the map and the pieces are painted. |
void |
addBoardMouseMotionListener(MouseMotionListener mml)
Adds the given MouseMotionListener to the area of the board where the map and the pieces are painted. |
Dimension |
boardSize()
Returns the size of the actual board, not counting the scroll bars and zoom buttons. |
void |
clearMap()
Description of the Method |
Rectangle |
getPieceBounds(Piece piece)
Returns the bounding rectangle of the given piece. |
Position |
getPositionAt(Point p)
Converts a screen point to the Position corresponding to that point. |
Point |
getScreenPoint(Position p)
Converts the given Position of the map to the actual screen Point in the board's coordinate system. |
void |
hideMapPoint(Point p)
Makes the given point of the map invisible. |
void |
loadMap(Map m)
Sets the map of the board. |
void |
mapUpdate(Point p,
int color)
Updates the given point of the map to the given color. |
void |
repaintBoard()
|
void |
setBoardCursor(Cursor cursor)
Set the cursor for the map area of the board. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Board(Game game)
game
- The Game object whose pieces are supposed to be painted on
this board.Method Detail |
public void setBoardCursor(Cursor cursor)
cursor
- The new BoardCursor valuepublic Position getPositionAt(Point p)
p
- A pixel in the board coordinate system.
public Point getScreenPoint(Position p)
p
- A position in the map coordinate system.
public Rectangle getPieceBounds(Piece piece)
piece
- A piece.
public void loadMap(Map m)
m
- Description of Parameterpublic void clearMap()
public void mapUpdate(Point p, int color)
p
- Description of Parametercolor
- Description of Parameterpublic void hideMapPoint(Point p)
p
- Description of Parameterpublic void addBoardMouseListener(MouseListener ml)
ml
- The new mouse listener.public void addBoardMouseMotionListener(MouseMotionListener mml)
mml
- The new mouse motion listener.public void repaintBoard()
public Dimension boardSize()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |