/** Overrides moveMade(MoveMadeEvent) to clear the board of any arrows/circles. */ public void moveMade(MoveMadeEvent evt) { super.moveMade(evt); if (evt.getGame() != game) return; ((ChessclubJBoard) board).removeAllArrows(); ((ChessclubJBoard) board).removeAllCircles(); }
/** Overrides positionChanged(PositionChangedEvent) to clear the board of any arrows/circles. */ public void positionChanged(PositionChangedEvent evt) { super.positionChanged(evt); if (evt.getGame() != game) return; ((ChessclubJBoard) board).removeAllArrows(); ((ChessclubJBoard) board).removeAllCircles(); }
/** Gets called when a circle is added to the board (by the server). */ public void circleAdded(CircleEvent evt) { if (evt.getGame() != game) return; handlingArrowCircleEvent = true; ((ChessclubJBoard) board).removeCircle(evt.getCircleSquare()); ((ChessclubJBoard) board).addCircle(evt.getCircleSquare(), Color.blue); handlingArrowCircleEvent = false; }
/** Gets called when an arrow is added to the board (by the server). */ public void arrowAdded(ArrowEvent evt) { if (evt.getGame() != game) return; handlingArrowCircleEvent = true; ((ChessclubJBoard) board).removeArrow(evt.getFromSquare(), evt.getToSquare()); ((ChessclubJBoard) board).addArrow(evt.getFromSquare(), evt.getToSquare(), Color.blue); handlingArrowCircleEvent = false; }
/** Overrides illegalMoveAttempted(IllegalMoveEvent) to clear the board of any arrows/circles. */ public void illegalMoveAttempted(IllegalMoveEvent evt) { super.illegalMoveAttempted(evt); if (evt.getGame() != game) return; ((ChessclubJBoard) board).removeAllArrows(); ((ChessclubJBoard) board).removeAllCircles(); }
/** Overrides takebackOccurred(TakebackEvent) to clear the board of any arrows/circles. */ public void takebackOccurred(TakebackEvent evt) { super.takebackOccurred(evt); if (evt.getGame() != game) return; ((ChessclubJBoard) board).removeAllArrows(); ((ChessclubJBoard) board).removeAllCircles(); }
/** * Override configureBoard(Game, JinBoard) to add ourselves as an ArrowCircleListener to the * board. */ protected void configureBoard(Game game, JinBoard board) { super.configureBoard(game, board); if ((game.getGameType() == Game.MY_GAME) && !game.isPlayed()) { board.addArrowCircleListener(this); board.setArrowCircleEnabled(true); } else ((ChessclubJBoard) board).setArrowCircleEnabled(false); }