ComboBox keypress discrepancy
Abhinay Agarwal
abhinay_agarwal at live.com
Thu Mar 5 10:43:53 UTC 2020
Hi,
We have come across a behavioural change in ComboBox b/w JavaFX 8 and 9+.
We are not sure if its a regression or a bug fix which is causing it. Therefore, I am reaching out to the community for insight.
If you run the following example, open the popup window in ComboBox and press TAB: JavaFX 8 registers the key press event, where as,
JavaFX 9 and later do not register it. The TAB keypress is registered successfully in bot cases when the popup window is not showing.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
final ComboBox<String> stringComboBox = new ComboBox<>();
stringComboBox.getItems().addAll("John", "Jacob", "Schmidt");
stringComboBox.addEventHandler(KeyEvent.KEY_PRESSED, kp -> System.out.println(kp.getCode()));
final Scene scene = new Scene(new BorderPane(stringComboBox), 300, 275);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
More information about the openjfx-dev
mailing list