Answer the question
In order to leave comments, you need to log in
How to access all content of ListView?
I have a ListView with custom rows
class CheckListCell extends ListCell<String> {
private BorderPane container = new BorderPane();
private Label text = new Label();
private CheckBox check = new CheckBox();
public CheckListCell() {
super();
container.setLeft(text);
container.setRight(check);
}
public boolean isBoxSelected(){
return check.isSelected();
}
@Override
protected void updateItem(String s, boolean b) {
super.updateItem(s, b);
setText(null);
setGraphic(null);
if (!b && s != null){
text.setText(s);
setGraphic(container);
}
}
}
ListView list;
ObservableList<String> items = FXCollections.observableArrayList("1","2","3");
list.getItems().setAll(items);
list.setCellFactory(param -> new CheckListCell());
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question