Is there mouse locking in processing?

I cant lock it in the middle because I wouldn’t be able to calculate mouse movement… or would I? please help.