See cursor() / Reference / Processing.org
So when mousePressed registers the mouse is in cell set to TEXT otherwise to ARROW
Upon key return / ESC set to ARROW as well etc.
might be easier to write a class Cell in the long run
Can you explain the 2nd question a bit more?