listview - JavaFX ListView Cell 多个图形
问题描述
是否有向 JavaFX ListView 单元格添加多个图形?
lstTest.setCellFactory(param -> {
ListCell<Test> cell = new ListCell<>();
cell.selectedProperty().addListener((observable, oldValue, newValue) -> {
handleCellDisplaying(cell);
});
cell.itemProperty().addListener((observable, oldValue, newValue) -> handleCellDisplaying(cell));
return cell;
});
和句柄CellDisplaying:
private void handleCellDisplaying(ListCell<Test> cell) {
FontIcon lockIcon = new FontIcon(FontAwesome.LOCK);
cell.setGraphic(lockIcon);
cell.setGraphic(bellIcon); //Multiple graphics here for the same cell
cell.setGraphic(etc.etc.);
}
}
解决方案
推荐阅读
- list - 如何对序言中的列表列表执行算术运算
- java - (android) 小吃吧结束后如何关闭活动?
- python - 如何在 django 表单中获取带有 ChoiceField 的字符串?
- android - CameraX:显示捕获的图像并应用效果
- javascript - 将 HTML 表格的表单输入字段转换为 JSON
- r - 使用 R 进行主成分分析。自动和手动结果不匹配
- javascript - 使用语音气球类型而不是模态类型显示布尔玛日历扩展
- javascript - 为什么我无法连接到部署到 Heroku 的 websocket 服务器?
- java - 如何从数组中获取随机对象
- c++ - 当我使用类执行链表时,它显示一个额外的零