gpt4 book ai didi

java - 如何在 SpreadsheetView 表格中添加按钮

转载 作者:行者123 更新时间:2023-11-30 08:12:51 26 4
gpt4 key购买 nike

如何在表格中创建对象(按钮、复选框)?

    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);

表中的输出:

Button@79280814[styleClass=button]'CLICK'

Button@3ad2325d[styleClass=button]'CLICK'

最佳答案

我想我已经找到了:)

1-)

 SpreadsheetCellBase cell = new SpreadsheetCellBase(row, column, 1, 1);

cell.setGraphic(new Button("Test Button"));

list.add(cell)
<小时/>

2-)

SpreadsheetCell cellIndex = SpreadsheetCellType.STRING.createCell(row, column, 1, 1,null); 

cellIndex.setGraphic(new Button("Test Button"));

cells.add(cellIndex);

关于java - 如何在 SpreadsheetView 表格中添加按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30125610/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com