Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. addButton.setOnAction(new EventHandler<ActionEvent>() {
  2.  
  3. @Override
  4. public void handle(ActionEvent event) {
  5. Operation operation = new Operation();
  6. operation.addRecord(dateTextField, distanceTextField, lpgAmountTextField, lpgPriceTextField,
  7. petrolAmountTextField, petrolPriceTextField, paidLabel, savingLabel, gasEfficiencyLabel,
  8. contentTable, totalSavingsLabel);
  9.  
  10. operation.totalPaidSaving(contentTable, totalSavingsLabel);
  11. }
  12.  
  13. });
  14.  
  15. @SuppressWarnings("unchecked")
  16. public void configurateTable() {
  17.  
  18. TableColumn<GasRecords, String> savingColumn = new TableColumn<GasRecords, String>(SAVING_COLUMN);
  19. savingColumn.setCellValueFactory(new PropertyValueFactory<>("saving"));
  20.  
  21.  
  22. contentTable.getColumns().addAll(dateColumn, distanceColumn, lpgAmountColumn, lpgPriceColumn, petAmountColumn,
  23. petPriceColumn, paidColumn, savingColumn, gasEfficiencyColumn);
  24.  
  25. }
  26.  
  27. public void totalPaidSaving(TableView<GasRecords> cT, Label tSL) {
  28.  
  29. String totalSavingValue = "0";
  30.  
  31. //the code that calculates the sum of the values โ€‹โ€‹of a particular column
  32.  
  33. tSL.setText(String.format("%.2f zล‚", totalSavingValue));
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement