added a keypressEvent method