code: public boolean onMove(int nIDMoveCommand)
      {
          Record record = this.getMainRecord();
          if (record == null)
              return false;
          try
          {
              if (record.isModified(false))
              {
                  if (record.getEditMode() == Constants.EDIT_IN_PROGRESS)
                      record.set();
                  else if (record.getEditMode() == Constants.EDIT_ADD)
                      record.add();
              }
              if ((nIDMoveCommand == Constants.NEXT_RECORD) && (!record.hasNext()))
                  this.onAdd();   // Next record, enter "Add" mode
              else if ((nIDMoveCommand == Constants.PREVIOUS_RECORD) && (!record.hasPrevious()))
                  this.onMove(Constants.FIRST_RECORD);      // Can't move before the first record
              else
                  record.move(nIDMoveCommand);
              record.isModified(false);
              this.clearStatusText();
          } catch(DBException ex) {
              this.displayError(ex);
              return false;
          }
          return true;    // Command processed
      }
docs: Process the "Move" Commands.
  @param nIDMoveCommand The move command (first/last/next/prev).
  @return true if successful.