Details
-
Bug
-
Resolution: Fixed
-
P4
-
8u74
-
x86_64
-
windows_7
Description
FULL PRODUCT VERSION :
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
When a ComboBox has the focus and the ENTER key is pressed,
the event bubbling doesn't work as expected.
Expected behaviour is that EventFilters are called from Top to Bottom starting at the scene. After that EventHandlers are called from Bottom to Top.
Expected sequence:
- scene filter
- combobox filter
- combobox handler
- scene handler
When ENTER key is pressed, the event filter and handler on the scene is called a second time.
observed sequence:
- scene filter
- combobox filter
- scene filter
- scene handler
- combobox handler
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. execute the provided example programm
2. make sure the combobox has the focus.
3. press ENTER key
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
following lines are printed:
scene filter
combobox filter
combobox handler
scene handler
ACTUAL -
following lines are printed:
scene filter
combobox filter
scene filter
scene handler
combobox handler
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Testpp extends Application {
public static void main(String... args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
ComboBox<String> cb = new ComboBox<>();
cb.getItems().addAll("Test", "hello", "world");
cb.addEventFilter(KeyEvent.KEY_RELEASED, event -> System.out.println("combobox filter"));
cb.addEventHandler(KeyEvent.KEY_RELEASED, event -> System.out.println("combobox handler"));
VBox root = new VBox(cb);
Scene scene = new Scene(root);
scene.addEventFilter(KeyEvent.KEY_RELEASED, event -> System.out.println("scene filter"));
scene.addEventHandler(KeyEvent.KEY_RELEASED, event -> System.out.println("scene handler"));
primaryStage.setScene(scene);
primaryStage.show();
}
}
---------- END SOURCE ----------
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
When a ComboBox has the focus and the ENTER key is pressed,
the event bubbling doesn't work as expected.
Expected behaviour is that EventFilters are called from Top to Bottom starting at the scene. After that EventHandlers are called from Bottom to Top.
Expected sequence:
- scene filter
- combobox filter
- combobox handler
- scene handler
When ENTER key is pressed, the event filter and handler on the scene is called a second time.
observed sequence:
- scene filter
- combobox filter
- scene filter
- scene handler
- combobox handler
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. execute the provided example programm
2. make sure the combobox has the focus.
3. press ENTER key
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
following lines are printed:
scene filter
combobox filter
combobox handler
scene handler
ACTUAL -
following lines are printed:
scene filter
combobox filter
scene filter
scene handler
combobox handler
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Testpp extends Application {
public static void main(String... args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
ComboBox<String> cb = new ComboBox<>();
cb.getItems().addAll("Test", "hello", "world");
cb.addEventFilter(KeyEvent.KEY_RELEASED, event -> System.out.println("combobox filter"));
cb.addEventHandler(KeyEvent.KEY_RELEASED, event -> System.out.println("combobox handler"));
VBox root = new VBox(cb);
Scene scene = new Scene(root);
scene.addEventFilter(KeyEvent.KEY_RELEASED, event -> System.out.println("scene filter"));
scene.addEventHandler(KeyEvent.KEY_RELEASED, event -> System.out.println("scene handler"));
primaryStage.setScene(scene);
primaryStage.show();
}
}
---------- END SOURCE ----------
Attachments
Issue Links
- relates to
-
JDK-8229914 Regression: eventFilter on TextField in editable ComboBox doesn't receive ENTER
- Open
-
JDK-8229924 Editable ComboBox: broken sequence in event dispatch on Enter
- Open
-
JDK-8231692 Test Infrastructure: enhance KeyEventFirer to inject keyEvents into scene
- Resolved