title: JavaFX TabPane: How to listen to selection changes
body: <p>I want to do some actions when user goes from one tab to another, since i made my form design with Scene Builder I cannot use code mentioned <a href="https://stackoverflow.com/questions/12269301/adding-a-listener-to-a-tabpane-created-with-tabpanebuilder">here</a> (He used <code>TabPaneBuilder</code> class)</p>
  
  <p>I guessed this code would work but it doesn't react to tab selection changes.</p>
  
  <pre><code>@FXML
  protected TabPane chatTabs;
  .
  .    
  .
  chatTabs.selectionModelProperty().addListener(
      new ChangeListener&lt;SingleSelectionModel&lt;Tab&gt;&gt; {
              @Override
              public void changed(ObservableValue&lt;? extends SingleSelectionModel&lt;Tab&gt;&gt; ov, SingleSelectionModel&lt;Tab&gt; t, SingleSelectionModel&lt;Tab&gt; t1) {
                  System.err.println("changed");
              }
          }
      }
  );
  </code></pre>