JavaFX ListView单元格多个图形

时间:2019-12-11 13:14:29

标签: listview javafx

反正有没有向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;
        });

和handleCellDisplaying:

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

0 个答案:

没有答案
相关问题