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

Exclamation key is undefined (Azerty Keyboards)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • tbd
    • 7u40
    • javafx
    • 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"

            mfox Martin Fox
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: