title: right click event and double click event on tableview javafx
body: <p>I am rewriting an application from swing to javafx.</p>
  
  <p>I do not understand how to implement a double click event and a right click event on the same row of a tableview.
  Separately they work ok.</p>
  
  <p>Thi is my code for right click behaviour.</p>
  
  <pre><code>words_table.setRowFactory(
  new Callback&lt;TableView&lt;WordsToFind&gt;, TableRow&lt;WordsToFind&gt;&gt;() {
  @Override
  public TableRow&lt;WordsToFind&gt; call(TableView&lt;WordsToFind&gt; tableView) {
  final TableRow&lt;WordsToFind&gt; row = new TableRow&lt;&gt;();
  final ContextMenu rowMenu = new ContextMenu();
  MenuItem removeItem = new MenuItem("Delete");
  removeItem.setOnAction(e -&gt; {
  int wordid = words_table.getSelectionModel().getSelectedItem().getWordToFindId();
  deleteWord(wordid);
  words_table.getItems().remove(row.getItem());
  });
  rowMenu.getItems().addAll(removeItem);
  row.contextMenuProperty().bind(
    Bindings.when(Bindings.isNotNull(row.itemProperty()))
    .then(rowMenu)
    .otherwise((ContextMenu)null));
  return row;
      }    
  });
  </code></pre>
  
  <p>This is my code for double click behaviour</p>
  
  <pre><code>words_table.setRowFactory(  
  new Callback&lt;TableView&lt;WordsToFind&gt;, TableRow&lt;WordsToFind&gt;&gt;() {
  @Override
  public TableRow&lt;WordsToFind&gt; call(TableView&lt;WordsToFind&gt; tableView) {
  final TableRow&lt;WordsToFind&gt; row = new TableRow&lt;&gt;();
  row.setOnMouseClicked(new EventHandler&lt;MouseEvent&gt;(){
      @Override
          public void handle(MouseEvent event){
              if (event.getClickCount() == 2 &amp;&amp; (! row.isEmpty()) ) {
                 some code here .....
              }
      }
  });
  return row;
      }    
  });
  </code></pre>
  
  <p>Thanks Alb</p>