title: Enable edit only for the selected row in the table
body: <p>I am fairly new in JavaFX. I have a table with multiple columns and an Edit <code>button</code> in each row. Whenever I click on the <code>Edit</code> 1st cell is selected for edit of that row. Everything goes fine but the problem is whenever I select a row and click on a cell of it also gets in edit mode though I have not clicked <code>Edit</code>. I think it's because I have made <code>tableView.setEditable(true)</code> but I want to enable edit only when I click Edit button and only for that row, not others when I double click/ single click. I have seen <a href="https://stackoverflow.com/questions/23884190/row-edit-in-tableview">this</a> but they have solved it by a pop-up. I don't want that.
  In the <code>initialize()</code> method I tried this way but it's not working exactly. Can anyone show me the correct way to do this, please? </p>
  
  <pre><code>tableBuilding.setRowFactory(tv -&gt; {
                  TableRow&lt;ModelBrBuilding&gt; row = new TableRow&lt;&gt;();
                  row.addEventFilter(MouseEvent.MOUSE_PRESSED, e -&gt; {
                      if (e.getButton() == MouseButton.SECONDARY) {
                          e.consume();
                      }
                  });
  
                 row.addEventFilter(MouseEvent.MOUSE_PRESSED,event -&gt; {
                  if ( event.getButton() == MouseButton.PRIMARY   &amp;&amp; event.getClickCount() == 2  ) {
                      event.consume();
                  }
                  });
                  return row ;
              });
  </code></pre>
  
  <p>and my button action looks like</p>
  
  <pre><code> EditButton.setOnAction((ActionEvent event)-&gt;{                  
                      TableRow row = cell.getTableRow();
                      tableBuilding.requestFocus();
                      tableBuilding.getSelectionModel().select(row.getIndex());            
                          int i=tableBuilding.getSelectionModel().getSelectedIndex();
                          tableBuilding.edit(i,colName);                                                          
                  });
  </code></pre>