If you try running the code below and move the "//" from minSize to prefSize, you will see that the listView does not honor minSize – only prefSize of list cells.
public class PersonListCellFactory implements Callback<ListView<Person>, ListCell<Person>> {
private boolean showFullNames;
public PersonListCellFactory() {
this(true);
}
public PersonListCellFactory(boolean showFullNames) {
this.showFullNames = showFullNames;
}
@Override
public ListCell call(ListView<Person> list) {
ListCell<Person> cell = new ListCell<Person>() {
@Override
protected void updateItem(Person person, boolean empty) {
super.updateItem(person, empty);
double size = 72;
// setMinSize(size, size);
setPrefSize(size, size);
if(!empty) {
setText("not empty);
}
else {
setText("empty");
};
return cell;
}
}
public class PersonListCellFactory implements Callback<ListView<Person>, ListCell<Person>> {
private boolean showFullNames;
public PersonListCellFactory() {
this(true);
}
public PersonListCellFactory(boolean showFullNames) {
this.showFullNames = showFullNames;
}
@Override
public ListCell call(ListView<Person> list) {
ListCell<Person> cell = new ListCell<Person>() {
@Override
protected void updateItem(Person person, boolean empty) {
super.updateItem(person, empty);
double size = 72;
// setMinSize(size, size);
setPrefSize(size, size);
if(!empty) {
setText("not empty);
}
else {
setText("empty");
};
return cell;
}
}