title: javafx keyboard event shortcut key
body: <p>I want to add keyboard shortcut key in javafx.</p>
  
  <p>i have scene and want to implement the keyboard shortcut</p>
  
  <p>my code is as follows</p>
  
  <pre><code>getApplication().getScene().setOnKeyPressed(new EventHandler&lt;KeyEvent&gt;() {
  
          public void handle(KeyEvent ke) {
              if (ke.getCode() == KeyCode.ESCAPE) {
                  System.out.println("Key Pressed: " + ke.getCode());
              }
          }
      });
  </code></pre>