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

TableColumn setId doesn't appear to work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8u20
    • 8u20
    • javafx
    • None

      See community discussion https://community.oracle.com/message/12383076

      Using id in lookup on table should find the TableColumn. I dumped out the node structure of the table and the TableColumn didn't have the id.

          @Override
          public void start(Stage stage) {
              TableColumn<Fruit, String> fruitNameCol = new TableColumn<>(
                      "Fruit"
              );
              fruitNameCol.setCellValueFactory(
                      new PropertyValueFactory<>(
                              "name"
                      )
              );
              fruitNameCol.setId("column-not-found");
              TableView<Fruit> table = new TableView<>(
                      FXCollections.<Fruit>observableArrayList(
                              new Fruit("apple"),
                              new Fruit("orange")
                      )
              );
              table.getColumns().setAll(
                      fruitNameCol
              );
              stage.setScene(
                      new Scene(
                              table, 50, 100
                      )
              );
              stage.show();
              System.out.println("Found column => " + table.lookup("column-not-found"));
          }
          public class Fruit {
              private String name;
              public Fruit(String name) { this.name = name; }
              public String getName() { return name; }
              public void setName(String name) { this.name = name; }
          }

            jgiles Jonathan Giles
            dgrieve David Grieve
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: