title: Javafx select multiple rows
body: <p>I'm trying to select multiple rows in JavaFX but I don't want to use keyboard (i.e. SHIFT key) for that. It should be selected after I click on it and when I click on another column it should be selected as well.</p>
  <p>I checked some other answers here but I couldn't find something short and handy. Is there a shorter way to do it?</p>
  <pre><code>@FXML 
  private static Logger logger = Logger.getLogger(MainFrameControl.class);
  
  public TableView&lt;Box&gt; boxTable;
  protected final ObservableList&lt;Box&gt; boxData = FXCollections.observableArrayList();
  
  Service service = new ServiceImpl();
  private Stage mainStage;
  
  public MainFrameControl(Stage mainStage) {
      FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(&quot;MainFrame.fxml&quot;));
      fxmlLoader.setRoot(this);
      fxmlLoader.setController(this);
      this.mainStage = mainStage;
  
      Stage stage = new Stage();
      try {
          fxmlLoader.load();  
      } catch (IOException exception) {
          throw new RuntimeException(exception);
      }
      ArrayList&lt;Box&gt; list = service.findAllBoxen();
  
      TableColumn&lt;Box, String&gt; boxnameColumn = (TableColumn&lt;Box, String&gt;) boxTable.getColumns().get(0);
      boxnameColumn.setCellValueFactory(new PropertyValueFactory&lt;Box, String&gt;(&quot;boxName&quot;));
  
      TableColumn&lt;Box, String&gt; sizeColumn = (TableColumn&lt;Box, String&gt;) boxTable.getColumns().get(1);
      sizeColumn.setCellValueFactory(new PropertyValueFactory&lt;Box, String&gt;(&quot;size&quot;));
      
      TableColumn&lt;Box, String&gt; windowColumn = (TableColumn&lt;Box, String&gt;) boxTable.getColumns().get(2);
      windowColumn.setCellValueFactory(new PropertyValueFactory&lt;Box, String&gt;(&quot;window&quot;));
      
      TableColumn&lt;Box, String&gt; costColumn = (TableColumn&lt;Box, String&gt;) boxTable.getColumns().get(3);
      costColumn.setCellValueFactory(new PropertyValueFactory&lt;Box, String&gt;(&quot;cost&quot;));
  
      TableColumn&lt;Box, String&gt; locationColumn = (TableColumn&lt;Box, String&gt;) boxTable.getColumns().get(4);
      locationColumn.setCellValueFactory(new PropertyValueFactory&lt;Box, String&gt;(&quot;location&quot;));
  
      TableColumn&lt;Box, Boolean&gt; beddingColumn = (TableColumn&lt;Box, Boolean&gt;) boxTable.getColumns().get(5);
      beddingColumn.setCellValueFactory(new PropertyValueFactory&lt;Box, Boolean&gt;(&quot;bedding&quot;));
      
      boxTable.setItems(boxData);
  </code></pre>