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

[ToggleGroup] RadioButton (and ToggleButton) is not selected by pressing space bar

    XMLWordPrintable

    Details

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

      java version "1.8.0_40-ea"
      Java(TM) SE Runtime Environment (build 1.8.0_40-ea-b09)
      Java HotSpot(TM) 64-Bit Server VM (build 25.40-b13, mixed mode)

      Description

      When a radio button has the focus but is not selected, I expect the space bar (on Windows at least) to select the button. This doesn't work, as you can verify with this small test program:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.RadioButton;
      import javafx.scene.control.ToggleGroup;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.layout.FlowPane;
      import javafx.stage.Stage;

      public class RadioButtonTest extends Application {

          @Override
          public void start(Stage stage) {
              stage.setTitle("Radio Button Test");
              RadioButton button1 = new RadioButton("Option 1");
              RadioButton button2 = new RadioButton("Option 2");
              RadioButton button3 = new RadioButton("Option 3");
              FlowPane flow = new FlowPane();
              flow.getChildren().add(button1);
              flow.getChildren().add(button2);
              flow.getChildren().add(button3);
              ToggleGroup group = new ToggleGroup();
              group.getToggles().add(button1);
              group.getToggles().add(button2);
              group.getToggles().add(button3);
              BorderPane pane = new BorderPane();
              pane.setTop(new Button("Button"));
              pane.setCenter(flow);
              pane.setBottom(new Button("Another button"));
              stage.setScene(new Scene(pane));
              stage.setWidth(400);
              stage.setHeight(300);
              stage.show();
          }

          public static void main(String[] args) {
              launch(args);
          }

      }

        Attachments

          Activity

            People

            Assignee:
            jgiles Jonathan Giles
            Reporter:
            dgilbertjfx David Gilbert (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: