-
Bug
-
Resolution: Fixed
-
P3
-
8u20, 8u40
-
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)
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);
}
}
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);
}
}