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

ComboBox docs for buttonCell could be improved

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 7u6
    • 7u6
    • javafx

      I suggest adding a simple example to the javadoc of ComboBox which shows the use of the button cell property. Yes, this may be trivial, but it did not dawn upon me, that I was not supposed to use the CellFactory to do this.

      Something like the following would have been helpful to me (feel free to copy paste this directly, if you agree):

      "The cell factory does not control how the combo box button area looks. Rather, to control the rendering of the button area, you assign a ListCell value to the buttonCell property. In the following example a custom list cell class called PlaceCell is used to render both the item list and the button of the combo box:

      placeComboBox.setCellFactory(new Callback<ListView<Place>, ListCell<Place>>() {
      @Override
      public ListCell<Place> call(ListView<Place> listView) {
      return new PlaceCell();
      }
      });
      placeComboBox.setButtonCell(new PlaceCell());
      "

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

              Created:
              Updated:
              Resolved:
              Imported: