-
Bug
-
Resolution: Duplicate
-
P4
-
7u40
-
Windows 7 64bits
On an azerty keyboard, when I press the key "!", the code of the key returned by KeyEvent is "Undefined".
The "!" key is just on left of the right "shift" key. (see http://en.wikipedia.org/wiki/File:KB_France.svg )
Snippet :
public class KeyboardCodeViewer
extends Application
{
public static void main(
final String[] args)
{
KeyboardCodeViewer.launch(args);
}
private TextArea textArea;
private Label label;
@Override
public void start(
final Stage primaryStage)
throws Exception
{
VBox root = new VBox();
label = new Label("Coucou");
label.setPrefSize(300d, 300d);
label.setFocusTraversable(true);
label.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(
final KeyEvent event)
{
textArea.appendText(event.getCode().getName() + " : " + event.getCode().impl_getCode() + '\n');
}
});
textArea = new TextArea();
textArea.setPrefSize(300d, 300d);
root.getChildren().add(label);
root.getChildren().add(textArea);
primaryStage.setScene(new Scene(root));
primaryStage.sizeToScene();
primaryStage.centerOnScreen();
primaryStage.show();
}
}
Start and then press a key, you should see the name and key code. But when you press "!", you'll get "Undefined"
The "!" key is just on left of the right "shift" key. (see http://en.wikipedia.org/wiki/File:KB_France.svg )
Snippet :
public class KeyboardCodeViewer
extends Application
{
public static void main(
final String[] args)
{
KeyboardCodeViewer.launch(args);
}
private TextArea textArea;
private Label label;
@Override
public void start(
final Stage primaryStage)
throws Exception
{
VBox root = new VBox();
label = new Label("Coucou");
label.setPrefSize(300d, 300d);
label.setFocusTraversable(true);
label.setOnKeyPressed(new EventHandler<KeyEvent>() {
@Override
public void handle(
final KeyEvent event)
{
textArea.appendText(event.getCode().getName() + " : " + event.getCode().impl_getCode() + '\n');
}
});
textArea = new TextArea();
textArea.setPrefSize(300d, 300d);
root.getChildren().add(label);
root.getChildren().add(textArea);
primaryStage.setScene(new Scene(root));
primaryStage.sizeToScene();
primaryStage.centerOnScreen();
primaryStage.show();
}
}
Start and then press a key, you should see the name and key code. But when you press "!", you'll get "Undefined"
- duplicates
-
JDK-8123632 KeyCodes do not reflect the keys that are actually pressed on German keyboard
- Resolved
- relates to
-
JDK-8087915 Mac: accelerator doesn't take into account azerty keyboard layout
- Closed