The window of Gregor's room is actually mentioned towards the beginning of the story, when Gregor wakes up and becomes aware of his hideous transformation. As the majority of the action of this story takes place in Gregor's room, what he can actually see through his window is going to be important in terms of setting the tone and the mood of the novel. Note what the text tells us about the window:
Gregor's eyes then focused on the window, and the dismal weather--raindrops could be heard splattering on the metal ledge--made him feel quite melancholy.
Note the way that this operates as a pathetic fallacy, for, even before his transformation, Gregor's life was rather "dismal." It is no wonder therefore that the weather enacts his mood and his impressions of life by its dismal nature, making him feel quite "melancholy" because of the grey, oppressive rain that can be heard "splattering" on the ledge.