In a simple ChoiceDialog (for example, see the minimal test program below), pressing the TAB key to move the focus to the next component does not include the 'Cancel' button in the traversal.
import java.util.Optional;
import javafx.application.Application;
import javafx.scene.control.ChoiceDialog;
import javafx.stage.Stage;
public class DialogTest extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
ChoiceDialog<String> choiceDialog = new ChoiceDialog<>("A", "A", "B", "C");
choiceDialog.setTitle("this is the title");
choiceDialog.setContentText("This is the content text.");
choiceDialog.setHeaderText(null);
Optional<String> result = choiceDialog.showAndWait();
if (result.isPresent()) {
System.out.println(result.get());
} else {
System.out.println("No selection");
}
}
}
import java.util.Optional;
import javafx.application.Application;
import javafx.scene.control.ChoiceDialog;
import javafx.stage.Stage;
public class DialogTest extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
ChoiceDialog<String> choiceDialog = new ChoiceDialog<>("A", "A", "B", "C");
choiceDialog.setTitle("this is the title");
choiceDialog.setContentText("This is the content text.");
choiceDialog.setHeaderText(null);
Optional<String> result = choiceDialog.showAndWait();
if (result.isPresent()) {
System.out.println(result.get());
} else {
System.out.println("No selection");
}
}
}