title: Ending a program when a certain key on the keyboard is pressed
body: <p>I want to be able to end my program when a certain key is pressed (For this example we will say when k is pressed). I know that this could be done by using <code>JFrame</code> and <code>KeyListener</code> but want this my listener to run in the background. My program currently modifies word documents which means the active window would not be <code>JFrame</code> so it would no be recording the keys that are pressed. Also <code>bufferd readers</code> are not an option as previously mentioned, the java program that is running is not the selected window. I have spent many hours researching different ways however all I have found is ways to see if they mouse is pressed using <code>AWTEvents</code> </p>
  
  <p>At the very worst case I will check to see if 2nd mouse button is pressed and end my code then, but ideally I would want to just end it on the key pressed. Any help would be great, comment for any clarification. </p>