Implemented the isPressed method.