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

ComboBox value property fires too many events on change

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • javafx
    • None

      Reproducible with following unit test that I added to the ComboBoxTest class:

      @Test public void test_jdk_8160493() {
          AtomicInteger count = new AtomicInteger();
          comboBox.valueProperty().addListener(o -> count.incrementAndGet());
          assertEquals(0, count.get());

          comboBox.getItems().addAll("Apple", "Orange", "Banana");
          sm.select(1);
          assertTrue(sm.isSelected(1));
          assertEquals(1, count.get());
          assertEquals("Orange", comboBox.getValue());

          comboBox.setValue("New Value");
          assertEquals(2, count.get());
          assertEquals("New Value", comboBox.getValue());
      }

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

              Created:
              Updated:
              Resolved: