According to https://wiki.openjdk.java.net/display/OpenJFX/ChoiceBox+User+Experience+Documentation
Any Alpha-numeric Keys should Jumps to the first item in the list with that letter or letters in the Selected state
However, this doesn't seem to be the case at all, typing when the widget is selected does not appear to do anything.
Here is my minimal reproducible example:
package com.techniqab.testchoicebox;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ChoiceBox;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import java.net.URL;
import java.nio.file.Paths;
public class TestchoiceboxApplication extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
URL url = Paths.get("./src/main/resources/sample.fxml").toUri().toURL();
Parent root = FXMLLoader.load(url);
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
var cb = new ChoiceBox();
cb.getItems().add("a");
cb.getItems().add("b");
((Pane) root).getChildren().add(cb);
}
public static void main(String[] args) {
launch(args);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="com.techniqab.testchoicebox.TestchoiceboxApplication"
prefHeight="400.0" prefWidth="600.0">
</AnchorPane>
module testchoicebox {
requires javafx.controls;
requires javafx.graphics;
requires javafx.fxml;
exports com.techniqab.testchoicebox;
opens com.techniqab.testchoicebox to javafx.graphics;
}