JavaFX TabPane disable tab switching by keys
问题 I have a Tab with some content: ScrollBar and other. The ScrollBar has event handler for keys: left and right . But if I press these buttons, Tabs are switched, because TabPane also has a key handler. How to disable default event handler for TabPane or change switching policy? 回答1: The problem is that a ScrollBar is not focus traversable by default and key events are only fired for focused Node s. You can set the ScrollBar focus traversable: sb.setFocusTraversable(true); sb.setOnKeyPressed(e