如何在我的表中创建一个对象(按钮,复选框)?
GridBase grid = new GridBase(20, 20);
ObservableList<ObservableList<SpreadsheetCell>> rows = FXCollections.observableArrayList();
for (int row = 0; row < grid.getRowCount(); ++row) {
final ObservableList<SpreadsheetCell> list = FXCollections.observableArrayList();
for (int column = 0; column < grid.getColumnCount(); ++column) {
list.add(new ObjectType().createCell(row, column, 1, 1, new Button("CLICK")));
}
rows.add(list);
}
grid.setRows(rows);
SpreadsheetView spv = new SpreadsheetView(grid);
表中的输出:
按钮@79280814[styleClass=button]'CLICK'
Button@3ad2325d[styleClass=button]'CLICK'