javafx logitech k400 keyevent


1 post
by tiran1984 » Thu Apr 27, 2017 10:06 pm
Hallo

I try to create a simple javafx application which listen to an key event.
The problem is, with a USB cable keywork i get an event, with wireless logitech k400 I dont get an key event.

The Keyboard works on no java application

I use the jdk8 131 the current version of armv6hf-sdk

Code: Select all
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class HelloWorld extends Application {

   @Override
   public void start(Stage primaryStage) {
      Button btn = new Button();
      btn.setText("Say 'Hello World'");
      btn.setOnAction(new EventHandler<ActionEvent>() {

         @Override
         public void handle(ActionEvent event) {
            System.out.println("Hello World!");
         }
      });

      StackPane root = new StackPane();
      root.getChildren().add(btn);

      Scene scene = new Scene(root, 300, 250);
      scene.setOnKeyTyped(new EventHandler<KeyEvent>() {
         public void handle(KeyEvent keyEvent) {
            System.out.println(keyEvent.getText());
         }
      });

      primaryStage.setTitle("Hello World!");
      primaryStage.setScene(scene);
      primaryStage.show();
   }

   public static void main(String[] args) {
      launch(args);
   }
}
Posts: 1
Joined: Thu Apr 27, 2017 9:59 pm