title: JavaFX: scrolling vs. focus traversal with arrow keys
body: <p>I got a <code>ScrollPane</code> containing focusable Nodes.</p>
  
  <p>The current default behaviour is:</p>
  
  <ul>
  <li><p><kbd>Shift</kbd> + <kbd>←</kbd>, <kbd>↑</kbd>, <kbd>→</kbd>, <kbd>↓</kbd> moves the focus</p></li>
  <li><p><kbd>←</kbd>, <kbd>↑</kbd>, <kbd>→</kbd>, <kbd>↓</kbd> scrolls the view</p></li>
  </ul>
  
  <p>I want it the other way around. 
  How can I accomplish this or where should I start?</p>
  
  <hr>
  
  <p><strong>[EDIT]</strong> Well, there is another fragile approach.</p>
  
  <p>Instead of messing around with the events, one could mess around with the <code>KeyBinding</code>s.</p>
  
  <pre><code>    scrollPane.skinProperty().addListener(new ChangeListener&lt;Skin&lt;?&gt;&gt;() {
          @Override
          public void changed(ObservableValue&lt;? extends Skin&lt;?&gt;&gt; observable, Skin&lt;?&gt; oldValue, Skin&lt;?&gt; newValue) {
              ScrollPaneSkin scrollPaneSkin = (ScrollPaneSkin) scrollPane.getSkin();
              ScrollPaneBehavior scrollPaneBehavior = scrollPaneSkin.getBehavior();
              try {
                  Field keyBindingsField = BehaviorBase.class.getDeclaredField("keyBindings");
                  keyBindingsField.setAccessible(true);
                  List&lt;KeyBinding&gt; keyBindings = (List&lt;KeyBinding&gt;) keyBindingsField.get(scrollPaneBehavior);
                  List&lt;KeyBinding&gt; newKeyBindings = new ArrayList&lt;&gt;();
                  for (KeyBinding keyBinding : keyBindings) {
                      KeyCode code = keyBinding.getCode();
                      newKeyBindings.add(code == KeyCode.LEFT || code == KeyCode.RIGHT || code == KeyCode.UP || code == KeyCode.DOWN ? keyBinding.shift() : keyBinding);
                  }
                  keyBindingsField.set(scrollPaneBehavior, newKeyBindings);
              } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
                  LOGGER.warn("private api changed.", e);
              }
          }
      });
  </code></pre>
  
  <p>I think, that could be the cleaner way, if KeyBindings  were more non-static, modifyable and public.</p>