Calling "setSelected(true)" on CheckBox fires ActionEvent

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 7u6
    • Affects Version/s: 7u6
    • Component/s: javafx
    • Environment:

      WinXP, Java 7, JavaFX 2.2 (b14)

      Calling "setSelected(true)" on CheckBox instance fires ActionEvent associated with this CheckBox. Example below prints "Triggered!". This behaviour was not present in JavaFX 2.2 (b4) and concerns only the first "setSelected(true)" call.

      CheckBox checkBox = new CheckBox();
      checkBox.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
              System.out.println("Triggered!");
          }
      });
      checkBox.setSelected(true);

      EDIT: Also, suppressing implicit selection switch doesn't work. The following example causes stack overflow when CheckBox is clicked.

      final CheckBox checkBox = new CheckBox();
      checkBox.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
              checkBox.setSelected(!checkBox.isSelected());
          }
      });

            Assignee:
            Kinsley Wong (Inactive)
            Reporter:
            Stepan Volf (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: