title: How to stop arrow keys navigating controls
body: <p>I'm trying to stop the arrow keys from navigating through the controls i have in my example. I'm not sure how to do this. Here is the example i have created:</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.event.EventHandler;
  import javafx.scene.Group;
  import javafx.scene.Node;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.input.KeyCode;
  import javafx.scene.input.KeyEvent;
  import javafx.scene.layout.FlowPane;
  import javafx.scene.shape.Rectangle;
  import javafx.stage.Stage;
  
  public class KeyEventTest extends Application{
  
      private EventHandler&lt;KeyEvent&gt; keyEventHandler;
  
      @Override
      public void start(Stage stage) throws Exception {
          // TODO Auto-generated method stub
          Group root = new Group();
          FlowPane f = new FlowPane();
          Button r = new Button("button1");
          Button r2 = new Button("button1");
          Button r3 = new Button("button1");
          f.getChildren().addAll(r,r2,r3);
          root.getChildren().add(f);
          Scene scene = new Scene(root,600,600);
          keyEventHandler = new EventHandler&lt;KeyEvent&gt;() {
              public void handle(final KeyEvent keyEvent) {
                  if (keyEvent.getCode() == KeyCode.LEFT || keyEvent.getCode() == KeyCode.UP) {
                      System.out.println("arrow keys");
                  }else{
                      System.out.println(keyEvent);
                  }
              }
          };
          stage.addEventHandler(KeyEvent.KEY_PRESSED, keyEventHandler);
  
  
          stage.setScene(scene);
          stage.show();
      }
  
      public static void main(String args[]){
          Application.launch(args);
      }
  
  }
  </code></pre>
  
  <p>Any help would be appreciated 
  Thanks</p>