我似乎无法连续显示数据。这将返回已成功实现的订单表。该表出现,并且如果我使用文字而不是变量,则数据可以正确显示(即,如果我放置“ Boo”,则可以代替orderRows [0])。我觉得我的鼻子下面有一些看不见的东西。注意,我已经确认我的OrderData类已成功将适当的字符串传递给OrderRows。我的行标题正确显示为“发货日期”。下面的行是空白的。我忘记了什么?
public class viewOrderTable {
//This is where my orderData is created.
//I have verified this is putting a correct value in OrderRows.
static OrderData orderData = new OrderData();
static OrderRows[] orderRows = orderData.GetOrderRows();
private final static ObservableList<OrderRows> rowMaker =
FXCollections.observableArrayList(orderRows[0]);
public static TableView<OrderRows> viewOrderTableBuilder() {
TableView<OrderRows> addOrderTable = new TableView();
TableColumn<OrderRows,String> shipDate = new
TableColumn<OrderRows,String> ("Ship Date");
shipDate.setCellValueFactory(new PropertyValueFactory("shipDate"));
addOrderTable.setItems(rowMaker);
addOrderTable.getColumns().addAll(shipDate);
return addOrderTable;
}
这是我的OrderRows类:
public class OrderRows {
private String shipDate;
public OrderRows(String shipDate,) {
this.shipDate = shipDate;
}
public String getshipDate() {
return shipDate;
}
}