In the movie, Jack has the same ability as Danny and therefore both are able to telepathically “Shine” images into the minds of other people. This is exactly what Danny does to Dick Hallorann in his bedroom in Florida when he needs his help. When Danny is beat up Jack is having a nightmare and his power to “Shine” combined with his increasing madness is what makes him able to lash out at Danny without being physically present. It couldn’t have been the old woman in 237 because, as Dick Hallorann tells Danny over ice cream, she’s only a vision of the past and not real. Having this special ability enables them to “Shine” these images into each others minds.
Click here and read more about Jack’s ability to “Shine”.