title: How to check for key being held down on startup in Java
body: <p>I'm trying to write a resolution selection dialog that pops up when a program first starts up. To prevent boring the user, I want to implement the fairly standard feature that you can turn off that dialog with a checkbox, but get it back by holding down the alt key at startup.</p>
  
  <p>Unfortunately, there is no obvious way to ask java whether a given key is <strong>currently being pressed</strong>. You can only register to be informed of new key presses via a KeyListener, but that doesn't help if the keypress starts before the app launches.</p>