How to change text in cells (SpreadsheetView by ControlsFX)?

一曲冷凌霜 提交于 2019-12-11 07:16:25

问题


I have the SpreadsheetView class in my programm:

SpreadsheetView table;

gridBase = new GridBase(rowCount, columnCount);
ObservableList<ObservableList<SpreadsheetCell>> rows = FXCollections.observableArrayList();
for (int row = 0; row < gridBase.getRowCount(); ++row) {
    final ObservableList<SpreadsheetCell> list = FXCollections.observableArrayList();
    for (int column = 0; column < gridBase.getColumnCount(); ++column) {
        SpreadsheetCell cell = SpreadsheetCellType.STRING.createCell(row, column, 1, 1, "value");
        list.add(cell);
    }
    rows.add(list);
}
gridBase.setRows(rows);

table = new SpreadsheetView(gridBase);

I can create cells:

SpreadsheetCell cell = SpreadsheetCellType.STRING.createCell(row, column, 1, 1, "value");

but i can't rewrite text in this cells. How can I do it?


回答1:


Just use the setCellValue method:

// set item in 6th row and 8th column
gridBase.setCellValue(5, 7, "Hello World");


来源:https://stackoverflow.com/questions/41134039/how-to-change-text-in-cells-spreadsheetview-by-controlsfx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!