add the use of window listener and window adapter