private void handleExitButton(ExitButton button) {
    // Check input
    if (button == null)
      throw new IllegalArgumentException("ExitButton can't be null");
    
    // Check a tile is currently selected
    if (selectedTileButton != null) {
      Point2D from = selectedTileButton.getBoardPosition();
      // Calculate the destination x/y based on which button was clicked
      int toX = (int) from.getX();
      int toY = (int) from.getY();
      // Make destination one square off the board in the relevant direction
      switch (button.getDirection()) {
        case Directional.BIG_X:
          toX = boardSize;
          break;
        case Directional.BIG_Y:
          toY = boardSize;
          break;
        case Directional.SMALL_X:
          toX = -1;
          break;
        case Directional.SMALL_Y:
          toY = -1;
          break;
        default:
          throw new IllegalStateException(
              "Invalid direction: " + button.getDirection());
      }
      try {
        Player movingPlayer = game.getActivePlayer();
        game.getBoard().moveTile(movingPlayer, from, new Point(toX, toY));
        // The move succeeded
      }
      catch (IllegalMoveException ex) {
        // The move was invalid
        rejectMove(ex.getMessage());
      }
    }
  }