Several keyboards have an Alt Gr key . On my Swedish keyboard layout, to enter a character [, I have to press Alt Gr+ 8(or Ctrl+ Alt+ 8).
If I entered this character twice in JavaFX TextField, where the application also has MenuBar, the menu bar holds focus instead of the text field. It makes me press again Altor Alt Grto focus TextField. I want to TextFieldhave focus after entering any character with the key Alt Gr.
Code to reproduce the problem:
public class MenuTest extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Pane pane = new VBox();
MenuBar menuBar = new MenuBar();
menuBar.getMenus().add(new Menu("_File"));
menuBar.getMenus().add(new Menu("_Test"));
TextField input = new TextField();
pane.getChildren().add(menuBar);
pane.getChildren().add(input);
Scene scene = new Scene(pane);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Steps to play:
With TextFieldfocus do:
- , Alt Gr + 8 ( Ctrl + Alt + 8) . , Alt Gr.
: [ TextField. TextField.
: [ TextField.
:
? "" Windows .
?