title: Javafx - Side-by-side TabPanes. How to find which Tab has focus/selection
body: <p>I have a JavaFX app with the following Node layout: </p>
  
  <ul>
  <li>SplitPane
  
  <ul>
  <li>TextArea</li>
  <li>SplitPane
  
  <ul>
  <li>TabPane </li>
  <li>TabPane </li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/siR52.png" alt="enter image description here"></p>
  
  <p>Example Code:  </p>
  
  <pre><code>SplitPane topBottomSplitPane = new SplitPane();
  
  TextArea displayTextArea = new TextArea();
  SplitPane leftRightSplitPane = new SplitPane();
  
  topBottomSplitPane.getItems().addAll(displayTextArea, leftRightSplitPane);
  
  TabPane leftTabPane = new TabPane();
  TabPane rightTabPane = new TabPane();
  
  leftRightSplitPane.getItems().addAll(leftTabPane, rightTabPane);
  </code></pre>
  
  <p>The TextArea, displayTextArea, is an non-editable text area that displays some text-data depending upon what data is present in the opened Tab objects inside the two TabPanes, leftTabPane and rightTabPane. The TabPane's SelectionModel is singular so that only one Tab may be selected at a time per TabPane.  </p>
  
  <p>One of the constraints I have is that only one of the open Tab objects data should be influencing displayTextArea's text. This was easy to accomplish when there was only one TabPane object by setting a OnSelectionChanged EventHandler and using isSelected() to determine if the change of selection was either a change into or out of selection. And the selected Tab would be the one influencing displayTextArea.  </p>
  
  <p>When there are two TabPanes I would want the Tab who's Content Node currently has focus, say a TextField or form where the user is entering data that will affect the text of displayTextArea. The way it would look from a user's perspective is they will be clicking through the open Tabs in both the TabPanes and the last one they clicked on would be influencing displayTextArea. But that is where I am running into a wall.  </p>
  
  <p>Attempted and Failed Approaches:  </p>
  
  <ol>
  <li><p>Setup some kind of listener to be notified of a change in focus from one of the Tab's content Node into another Tab's content Node, regardless of which TabPane they are in, then update the displayTextArea accordingly. - There is no AddFocusListener method and I am unsure how to work with the available focus oriented methods and functionality to achieve this behavior.  </p></li>
  <li><p>Force only 1 Tab to be selected at any one time between multiple TabPanes and stick with the aforementioned OnSelectionChanged EventHandler approach. - I don't know where to start on this one and I have not been able to find anything on it.  </p></li>
  </ol>
  
  <p>In this <a href="https://stackoverflow.com/questions/15646724/javafx-setfocus-after-tabpaine-change">question</a> there is the topic of changing focus into a TextField object in the Tab's Content Node but I was unable to grab anything useful for my purpose from that post.  </p>
  
  <p>I am lost here and don't know how to implement the necessary functionality for this display.</p>