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

[ToggleGroup] incorrect behavior of selectToggle method

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Environment:

      8.0b75

      Description

      At least, I think, it is incorrect, because javadoc is not too rich, to think anything else.

      So, code:

          @Override
          public void start(Stage primaryStage) {
              final ToggleGroup tg = new ToggleGroup();

              ToggleButton tb1 = new ToggleButton("toggle 1");
              final ToggleButton tb2 = new ToggleButton("toggle 2");

              tg.getToggles().addAll(tb1, tb2);

              Button b = new Button("Select toggle");
              b.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent t) {
                      tg.selectToggle(tb2);
                  }
              });

              primaryStage.setScene(new Scene(new VBox(tb1, tb2, b)));

              primaryStage.show();
          }

      We have 2 toggle buttons, and 1 button. That button selects "toggle 2" in the toggle group.

      To reproduce:
      1) click button -> toggle 2 is selected. ok
      2) click button -> toggle 2 is unselected. <- that is strange, because I ask to select it (javadoc is incorrect?)
      3) click button * n times (n > 0) -> nothing happens (toggle 2 is not selected any more).

      Issue came from : http://stackoverflow.com/questions/14885346/togglegroup-selecttoggle-bug

        Attachments

          Activity

            People

            Assignee:
            msladecek Martin Sládeček
            Reporter:
            akirov Alexander Kirov (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: