title: JavaFX8: How to create listener for selection of row in Tableview?
body: <p>I currently have two tableviews in one screen, which results in both TableViews have rows which the user can select.</p>
  
  <p>Now I want only one row to be selected at the same time (doesn't matter which TableView it is selected from). I was thinking about some kind of listener which deselects the other row when a row is selected. This is my initial setup:</p>
  
  <p><strong>Step 1</strong>
  Search for a way to bind a method to the selection of a row (there is not something like <code>tableview.setOnRowSelected(method)</code>)</p>
  
  <p><strong>Step 2</strong>
  Create the method which acts like a kind of listener: when a row is selected, deselect the other row (I know how to do this part)</p>
  
  <pre><code>Class1 selectedObject1 = (Class1)tableview1.getSelectionModel().getSelectedItem();
  Class2 selectedObject2 = (Class2)tableview2.getSelectionModel().getSelectedItem();
  
  if(selectedObject1 != null &amp;&amp; selectedObject2 != null) {
     tableview1.getSelectionModel().clearSelection();
  }
  </code></pre>
  
  <p>So, step one is the problem. I was thinking of an observable list on which a listener can be created, and then add the selected row to the list. When this happens, the listener can call the method.
  Anyone any clue how to make this?</p>
  
  <p>Any help is greatly appreciated.</p>