Use a component listener to detect when the size of the window is changed.