-
Bug
-
Resolution: Unresolved
-
P3
-
jfx11, jfx12, jfx13
To reproduce, compile and run the example below
- press enter in the combo's textField
- expected: log message printed
- actual: nothing printed
This is a regression ofJDK-8145515, probably (don't have an intermediate version handy to verify) introduced by fixing JDK-8149622.
Both fixes reside in ComboBoxPopupControl.handleKeyEvent. The fixing idea (afaiu) of the former was to fire a not consumed enter onto the textField (and prevent back-fireing by a custom flag on the textField properties). After fixing the latter, an uncomsumed enter is only fired for eventType keyReleased.
The example:
public class TextFieldInComboBug extends Application {
private Parent createContent() {
ComboBox<String> comboBox = new ComboBox<>();
comboBox.setEditable(true);
comboBox.getItems().addAll("something to choose", "another thingy to have");
// regression of https://bugs.openjdk.java.net/browse/JDK-8145515
// ENTER not received
comboBox.getEditor().addEventFilter(KeyEvent.KEY_PRESSED, e -> {
LOG.info("got key in editor filter: " + e);
});
VBox content = new VBox(10, comboBox);
return content;
}
@Override
public void start(Stage stage) throws Exception {
stage.setScene(new Scene(createContent()));
//stage.setTitle(FXUtils.version());
stage.show();
}
public static void main(String[] args) {
launch(args);
}
@SuppressWarnings("unused")
private static final Logger LOG = Logger
.getLogger(TextFieldInComboBug.class.getName());
}
- press enter in the combo's textField
- expected: log message printed
- actual: nothing printed
This is a regression of
Both fixes reside in ComboBoxPopupControl.handleKeyEvent. The fixing idea (afaiu) of the former was to fire a not consumed enter onto the textField (and prevent back-fireing by a custom flag on the textField properties). After fixing the latter, an uncomsumed enter is only fired for eventType keyReleased.
The example:
public class TextFieldInComboBug extends Application {
private Parent createContent() {
ComboBox<String> comboBox = new ComboBox<>();
comboBox.setEditable(true);
comboBox.getItems().addAll("something to choose", "another thingy to have");
// regression of https://bugs.openjdk.java.net/browse/JDK-8145515
// ENTER not received
comboBox.getEditor().addEventFilter(KeyEvent.KEY_PRESSED, e -> {
LOG.info("got key in editor filter: " + e);
});
VBox content = new VBox(10, comboBox);
return content;
}
@Override
public void start(Stage stage) throws Exception {
stage.setScene(new Scene(createContent()));
//stage.setTitle(FXUtils.version());
stage.show();
}
public static void main(String[] args) {
launch(args);
}
@SuppressWarnings("unused")
private static final Logger LOG = Logger
.getLogger(TextFieldInComboBug.class.getName());
}
- relates to
-
JDK-8229924 Editable ComboBox: broken sequence in event dispatch on Enter
- Open
-
JDK-8145515 addEventFilter for combobox editor does not react on key action enter
- Resolved
-
JDK-8149622 ComboBox produces unexpected event behaviour when ENTER key is pressed
- Resolved
-
JDK-8231692 Test Infrastructure: enhance KeyEventFirer to inject keyEvents into scene
- Resolved