Rectangle area = canvas.getBoardPainter().getPlayArea();
Rectangle area = canvas.getBoardPainter().getViewedArea();
  public Rectangle doMoveCursor(int keyCode) {    boolean refreshPainter = false;    Rectangle area = canvas.getBoardPainter().getPlayArea();    byte x = cursor.x;    byte y = cursor.y;    switch (canvas.getGameAction(keyCode)) {    case MainCanvas.ACTION_UP:      if (y > 0) {        y--;        if (y < area.y0) {          area.y0 = y;          area.y1--;          refreshPainter = true;        }      }      break;    case MainCanvas.ACTION_DOWN:      if (y < board.getBoardSize() - 1) {        y++;        if (y > area.y1) {          area.y1 = y;          area.y0++;          refreshPainter = true;        }      }      break;    case MainCanvas.ACTION_LEFT:      if (x > 0) {        x--;        if (x < area.x0) {          area.x0 = x;          area.x1--;          refreshPainter = true;        }      }      break;    case MainCanvas.ACTION_RIGHT:      if (x < board.getBoardSize() - 1) {        x++;        if (x > area.x1) {          area.x1 = x;          area.x0++;          refreshPainter = true;        }      }      break;    default:    }    if (refreshPainter) {      tuneBoardPainter();      canvas.getBoardPainter().setPlayArea(area); // Otherwise it will not be notified of the change    }    boolean refreshNeeded = (x != cursor.x) || (y != cursor.y);    if (refreshNeeded) {      areaToRefresh.x0 = canvas.getBoardPainter().getCellX(Math.min(x, cursor.x) - 1);      areaToRefresh.x1 = canvas.getBoardPainter().getCellX(Math.max(x, cursor.x) + 1);      areaToRefresh.y0 = canvas.getBoardPainter().getCellY(Math.min(y, cursor.y) - 1);      areaToRefresh.y1 = canvas.getBoardPainter().getCellY(Math.max(y, cursor.y) + 1);      //#ifdef DEBUG      //log.debug("Area to refresh = (" + areaToRefresh.x0 + "," + areaToRefresh.y0 + ")-(" + areaToRefresh.x1 + "," + areaToRefresh.y1 + ")");      //#endif    }    cursor.x = x;    cursor.y = y;    return refreshNeeded ? areaToRefresh : null;  }