title: Close window on pressing of certain key
body: <p>I just started using java and am not very good, so if you could help me that would be awesome! I'm making a <code>Swing</code> application and want to close it only when a certain key is pressed. Is there a way to do this?</p>