TableColumn<Product, Double> priceCol = new TableColumn<Product,Double>("Price");
priceCol.setCellValueFactory(new PropertyValueFactory<Product, Double>("price"));
Run Code Online (Sandbox Code Playgroud)
如何格式化此列中的双精度数以保留 2 位小数(因为它们是价格列)?默认情况下,它们仅显示 1 位小数。