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

[TableView] TableView custom TableCell with ComboBoxes not editable.



      I have this sample that creates a TableView with a single column and a single line.

      I have overridden the cellfactory so that a ComboBox is showing when I want to edit the value.

      In JDK8, when you were double-clicking on the first cell, the ComboBox was showing properly and you could select an item.

      In JDK8u20 b17, the comboBox is showing (without the displayed items) but it is not possible to interract with it. It's impossible to select any item. This is a great regression. It's doing the same with ChoiceBox, DatePicker etc etc. It is because I want to show (display the list) directly and I call "editor.show()". This is causing the problem.

      Step to reproduce:
      Run this sample:
      import java.util.Arrays;
      import java.util.List;
      import javafx.application.Application;
      import static javafx.application.Application.launch;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.control.ComboBox;
      import javafx.scene.control.TableCell;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.stage.Stage;
      import javafx.util.Callback;

      public class TableViewSample extends Application {

          private TableView<String> table = new TableView<>();

          public static void main(String[] args) {

          private final List<String> countryList = Arrays.asList("China", "France", "New Zealand",
                  "United States", "Germany", "Canada");

          public void start(Stage stage) {
              Scene scene = new Scene(new Group());

              ComboBox<String> comboBox = new ComboBox<>();

              stage.setTitle("Table View Sample");


              TableColumn firstNameCol = new TableColumn("First Name");
              firstNameCol.setCellFactory(new Callback() {

                  public Object call(Object param) {
                      return new TableCell<String, String>() {
                           * {@inheritDoc}
                          public void startEdit() {
                              ObservableList<String> items = FXCollections.observableList(countryList);

                              comboBox.show(); // This call is causing the trouble.

                           * {@inheritDoc}
                          public void cancelEdit() {



              ((Group) scene.getRoot()).getChildren().addAll(table);


      Double click on the very first cell (even if nothing is shown).
      A ComboBox appears. It's working nice in JDK8 but not in JDK8u20 b17.


          Issue Links



              • Assignee:
                dgrieve David Grieve
                shadzic Samir Hadzic
              • Votes:
                0 Vote for this issue
                4 Start watching this issue


                • Created: