title: Javafx Custom TableCell
body: <p>I have tables with editable fields item,Description,Quantity,Unit price and Sub Total.</p>
  
  <p>I am creating a cellFactory and Column Update like this:</p>
  
  <pre><code>   TableColumn DescriptionCol = new TableColumn("Description");
      EditableTableSupport.createEditingColumn(DescriptionCol,"description");
  
      TableColumn QuantityCol = new TableColumn("Quantity");
      EditableTableSupport.createEditingColumn(QuantityCol,"quantity");
  
      TableColumn UnitPriceColumn = new TableColumn&lt;&gt;("Unit Price");
      EditableTableSupport.createEditingColumn(UnitPriceColumn,"unitPrice");
  
      TableColumn DiscountColumn = new TableColumn&lt;&gt;("Discount");
      EditableTableSupport.createEditingColumn(DiscountColumn,"discount");
  
      SubTotalColumn = new TableColumn&lt;&gt;("SubTotal");
      EditableTableSupport.createColumn(SubTotalColumn,"subTotal");
  
      TableColumn SubTotalColumn = new TableColumn&lt;&gt;("SubTotal");
      EditableTableSupport.createColumn(SubTotalColumn,"subTotal");
  
          DescriptionCol.setOnEditCommit(new EventHandler&lt;TableColumn.CellEditEvent&lt;DUMMY_PurchaseOrderLine, String&gt;&gt;() {
          @Override
          public void handle(TableColumn.CellEditEvent&lt;DUMMY_PurchaseOrderLine, String&gt; t) {
              ((DUMMY_PurchaseOrderLine) t.getTableView().getItems().get(t.getTablePosition().getRow())).setDescription(t.getNewValue());
          }
      });
  
  
  
      QuantityCol.setOnEditCommit(new EventHandler&lt;TableColumn.CellEditEvent&lt;DUMMY_PurchaseOrderLine, String&gt;&gt;() {
          @Override
          public void handle(TableColumn.CellEditEvent&lt;DUMMY_PurchaseOrderLine, String&gt; t) {
              ((DUMMY_PurchaseOrderLine) t.getTableView().getItems().get(t.getTablePosition().getRow())).setQuantity(t.getNewValue());
  
          }
      });
  
      UnitPriceColumn.setOnEditCommit(new EventHandler&lt;TableColumn.CellEditEvent&lt;DUMMY_PurchaseOrderLine, String&gt;&gt;() {
          @Override
          public void handle(TableColumn.CellEditEvent&lt;DUMMY_PurchaseOrderLine, String&gt; t) {
              ((DUMMY_PurchaseOrderLine) t.getTableView().getItems().get(t.getTablePosition().getRow())).setUnitPrice(t.getNewValue());
          }
      });
  
  
  
      DiscountColumn.setOnEditCommit(new EventHandler&lt;TableColumn.CellEditEvent&lt;DUMMY_PurchaseOrderLine, String&gt;&gt;() {
          @Override
          public void handle(TableColumn.CellEditEvent&lt;DUMMY_PurchaseOrderLine, String&gt; t) {
              ((DUMMY_PurchaseOrderLine) t.getTableView().getItems().get(t.getTablePosition().getRow())).setDiscount(t.getNewValue());
          }
      });
  
  
     public class EditableTableSupport {
  
     public static void createEditingColumn(TableColumn Column ,String name){
  
  
    Callback&lt;TableColumn, TableCell&gt; cellFactory = new Callback&lt;TableColumn, TableCell&gt;() {
          @Override
          public TableCell call(TableColumn p) {
              return new EditingCell();
          }
      };
  
      Column.setSortable(false);
      Column.setCellValueFactory(new PropertyValueFactory&lt;DUMMY_PurchaseOrderLine, String&gt;(name));
      Column.setCellFactory(cellFactory);
  
  }
  
  
  public static void createColumn(TableColumn Column, String name) {
      Column.setSortable(false);
      Column.setCellValueFactory(new PropertyValueFactory&lt;DUMMY_PurchaseOrderLine, String&gt;(name));
  
  }}
  </code></pre>
  
  <p>Question:How to Update Subtotal Column When i updating Quantity Column or UnitPrice Column</p>
  
  <p>Thank you..</p>
  
  <pre><code>public class DUMMY_PurchaseOrderLine {
  
  private String name;
  private String description;
  private BigDecimal quantity;
  private BigDecimal unitPrice;
  private BigDecimal discount;
  private BigDecimal subTotal;
  
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  
  public String getDescription() {
      return description;
  }
  
  public void setDescription(String description) {
      this.description = description;
  }
  
  
  
  public BigDecimal getQuantity() {
      return quantity;
  }
  
  public void setQuantity(BigDecimal quantity) {
      this.quantity = quantity;
  }
  
  public BigDecimal getUnitPrice() {
      return unitPrice;
  }
  
  public void setUnitPrice(BigDecimal unitPrice) {
      this.unitPrice = unitPrice;
  }
  
  public BigDecimal getDiscount() {
      return discount;
  }
  
  public void setDiscount(BigDecimal discount) {
      this.discount = discount;
  }
  
  public BigDecimal getSubTotal() {
      return subTotal;
  }
  
  public void setSubTotal(BigDecimal subTotal) {
      this.subTotal = subTotal;
  }
  
  
   public DUMMY_PurchaseOrderLine(String name, BigDecimal description, BigDecimal quantity,BigDecimal unitPrice,BigDecimal discount,BigDecimal subTotal) {
      this.name = name;
      this.description = description;
      this.quantity = quantity;
      this.unitPrice = unitPrice;
      this.discount = discount;
      this.subTotal = quantity.multiply(unitPrice).subtract(discount);
  
  }
  </code></pre>
  
  <p>}</p>