i am doing some basic Java Swing application (beginner level) . what i have to do is when i press close …