Ignatiamus
Posts: 4
Joined: Wed Aug 16, 2017 9:51 am

Numpad keys don't throw KeyEvents under JavaFX on RPi3

Sun Jan 07, 2018 4:58 pm

Hello,

While programming a JavaFX application for the Raspberry Pi 3 using the official JavaFXPorts from Gluon, I encountered the following problem: Pressing the numpad keys on my keyboard doesn't give me any `KeyEvent`, while on my normal PC it does as it should!

Here's a minimal verifiable example that demonstrates my problem:

Code: Select all

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class InputTest extends Application {

   public static void main(String[] args) {
      launch(args);
   }

   @Override
   public void start(Stage stage) {
      Scene s = new Scene(new Group(), 800, 600, Color.ALICEBLUE);
      s.setOnKeyPressed((e) -> {
         KeyCode code = e.getCode();
         System.out.println(code);
         if (code.equals(KeyCode.ESCAPE)) {
            System.exit(0); // To be able to exit on the RasPi.
         }
      });
      stage.setScene(s);
      stage.show();
   }
}
Just try pressing the numpad keys, and no events will be fired, while normal keys do work.

Also, it doesn't depend on the numlock state, but my guess would be that my keyboard layout is wrong, maybe?

Any help would be appreciated.

I've already asked this question over on raspberrypi.stackexchange.com, but I don't think that's the right place.

Cheers

squareconcepts
Posts: 1
Joined: Tue Jan 09, 2018 11:03 am

Re: Numpad keys don't throw KeyEvents under JavaFX on RPi3

Tue Jan 09, 2018 11:07 am

I have the exact same situation.

I build an application back in 2015 and wanted to make some extra modifications. But with the newer java arm versions with gluon added the numpad is not giving me any input.

Also the numpad on a normal keyboard is not working.

In the terminal at the raspberry pi the numpad works as it should, and the numpad is also working on my application at my development system.

Ignatiamus
Posts: 4
Joined: Wed Aug 16, 2017 9:51 am

Re: Numpad keys don't throw KeyEvents under JavaFX on RPi3

Tue Jan 09, 2018 3:42 pm

I have now tested it under the standard out-of-the-box Raspian and Ubuntu 16.04 for the Pi. I doesn't work on both systems, independent of the keyboard layout. In other programs the numpad works as it should.
squareconcepts wrote:
Tue Jan 09, 2018 11:07 am
I have the exact same situation.

I build an application back in 2015 and wanted to make some extra modifications. But with the newer java arm versions with gluon added the numpad is not giving me any input.

Also the numpad on a normal keyboard is not working.

In the terminal at the raspberry pi the numpad works as it should, and the numpad is also working on my application at my development system.
It's good at one hand to have this issue confirmed by another person, but bad at the other hand because then i can't use JavaFX for my little application.

On my normal PC everything is working fine, so I don't know why it doesn't for you.

Cheers

Return to “Java”

Who is online

Users browsing this forum: No registered users and 4 guests