Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8124039

[ListView, TreeView] does not honor min height of cells

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 7u21
    • javafx
    • None
    • FX 2.2.21-b11

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

            jgiles Jonathan Giles
            risaksen Randahl Isaksen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: