如何将tableview的一列的数据添加到同一个表的另一列,但执行x操作(如add5)?
在我的例子中,我想将intaxcolumn*0.79的数据添加到outtax列。
这是控制器
//Imports
public class ControladorView implements Initializable {
@FXML private TableView tableViewBudget;
@FXML private TableColumn<Product, String> nameBudgetColumn;
@FXML private TableColumn<Product, Double> outTaxColumn;
@FXML private TableColumn<Product, Double> inTaxColumn;
@FXML private TableColumn<Product, Integer> quantityColumn;
private ObservableList<Product> budgetData;
@Override
public void initialize(URL location, ResourceBundle resources) {
//Budget Table
nameBudgetColumn.setCellValueFactory(
new PropertyValueFactory<>("description"));
inTaxColumn.setCellValueFactory(
new PropertyValueFactory<>("price"));
budgetData = FXCollections.observableArrayList();
tableViewBudget.setItems(budgetData);
}
产品类别:
public class Product {
public enum Category {
SPEAKER, HDD, HDD_SSD, POWER_SUPPLY, DVD_WRITER, RAM, SCREEN,
MULTIREADER, MOTHERBOARD, CPU, MOUSE, GPU, KEYBOARD, CASE, FAN
}
public Product(String description, double price, int stock, Category category) {
this.description = description;
this.price = price;
this.stock = stock;
this.category = category;
}
public Category getCategory() {
return category;
}
public String getDescription() {
return description;
}
public double getPrice() {
return price;
}
public int getStock() {
return stock;
}
private final String description;
private final double price;
private final int stock;
private final Category category;
}
1条答案
按热度按时间lstz6jyr1#
你能做到的