Editable ComboBox bug ?
omathe at free.fr
omathe at free.fr
Mon Sep 1 14:08:20 UTC 2014
In fact It is not a bug, I have just found the right way to get the value :
System.out.println("comboBox value : " + comboBox.getEditor().textProperty().get());
instead of
System.out.println("comboBox value : " + comboBox.valueProperty().get());
Sorry for the trouble
Olivier
----- Mail original -----
De: omathe at free.fr
À: "openjfx-dev at openjdk.java.net Mailing" <openjfx-dev at openjdk.java.net>
Envoyé: Lundi 1 Septembre 2014 15:55:59
Objet: Editable ComboBox bug ?
Hi,
I have reproduce in a small example a ComBox behavior which I suspect to be a bug.
When the TextField intercepts the event, the println displays the current value => OK
When the ComboBox (which is an editable one) intercept the event the println does not display the current value => bug ?
@Override
public void start(Stage primaryStage) {
TextField textField = new TextField();
ComboBox comboBox = new ComboBox();
comboBox.setEditable(true);
EventHandler eventHandler = (Event e) -> {
System.out.println("textField textValue : " + textField.textProperty().get());
System.out.println("comboBox value : " + comboBox.valueProperty().get());
};
textField.addEventFilter(KeyEvent.KEY_RELEASED, eventHandler);
comboBox.addEventFilter(KeyEvent.KEY_RELEASED, eventHandler);
StackPane root = new StackPane();
VBox vBox = new VBox(textField, comboBox);
root.getChildren().addAll(vBox);
Scene scene = new Scene(root, 300, 250);
primaryStage.setScene(scene);
primaryStage.show();
}
Could you please confirm if it is a bug ?
Thanks
Olivier
More information about the openjfx-dev
mailing list