title: Getting first column value of selected row
body: <p>I have encountered some problem when selecting a row and get the index in first column. I know you can do this in Java Swing:</p>
  
  <pre><code>jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      // Fire this when selected value changed
      jTable.getSelectionModel().addListSelectionListener(
              new ListSelectionListener() {
                  @Override
                  public void valueChanged(ListSelectionEvent e) {
                      if (!e.getValueIsAdjusting()) {
                          int viewRow = jTable.getSelectedRow();
                          // Get the first column data of the selectedrow
                          int topicID = Integer.parseInt(jTable.getValueAt(
                                  viewRow, 0).toString());
  }
              });
  </code></pre>
  
  <p>And this is how I populate my table data:</p>
  
  <pre><code>public void getAndPopulateCategory() {
      data = FXCollections.observableArrayList();
      try {
          db.getConnection();
          String sql = "SELECT * FROM sm_category";
          ResultSet rs = null;
          // Call readRequest to get the result
          rs = db.readRequest(sql);
  
          while (rs.next()) {
              ObservableList&lt;String&gt; row = FXCollections.observableArrayList();
              //All the rows are added here dynamically 
              row.add(rs.getString("categoryID"));
              row.add(rs.getString("categoryName"));
              row.add(rs.getString("categoryDescription"));
              data.add(row);
          }
          viewCategory.setItems(data);
          rs.close();
      } catch (SQLException ex) {
          ex.printStackTrace();
          System.out.println("Error SQL!!!");
          System.exit(0);
      }
  
      TableColumn id = new TableColumn("ID");
      id.setVisible(false);
      id.setCellValueFactory(new Callback&lt;TableColumn.CellDataFeatures&lt;ObservableList, String&gt;, ObservableValue&lt;String&gt;&gt;() {
          public ObservableValue&lt;String&gt; call(TableColumn.CellDataFeatures&lt;ObservableList, String&gt; param) {
              return new SimpleStringProperty(param.getValue().get(0).toString());
          }
      });
  
      viewCategory.getColumns().addAll(id;
  }
  </code></pre>
  
  <p>I am trying to do like get the first column value of selected row in javaFX. Anybody knows? Thanks in advance.</p>