Don't have Telegram yet? Try it now!
https://kodejava.org/how-do-i-handle-jframe-window-events/
How do I handle JFrame window events?