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

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

    XMLWordPrintable

Details

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

    Description

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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported: