【发布时间】:2015-10-27 10:00:21
【问题描述】:
假设我有一个名为 Employee 的类。
Employee 有一个字符串名称、整数年龄和一个自定义对象 Workstyle ethic。 Workstyle 具有私有 String 样式。
在我们的 GUI 类中,我们创建 TableColumns:
TableColumn<Professional, String> nameColumn = new TableColumn<>("NAME");
nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
//
TableColumn<Employee, Integer> ageColumn = new TableColumn<>("AGE");
nameColumn.setCellValueFactory(new PropertyValueFactory<>("age"));
//
现在我迷路了。我做不到:
TableColumn<Employee, String> workstyleColumn = new TableColumn<>("WORKSTYLE");
workstyleColumn.setCellValueFactory(new PropertyValueFactory<>("ethic.getStyle()"));
一定有办法拥有:
TableColumn<Object Being Looked At, Type being put onto the column> columnTitle = new TableColumn<>(
{
// I want to put tons of code here which EVENTUALLY ends with a object of type "Type being put onto the column".
});
感谢您的帮助!
【问题讨论】:
标签: java javafx factory tablecolumn