-
Bug
-
Resolution: Fixed
-
P3
-
8, 9
-
generic
-
generic
FULL PRODUCT VERSION :
java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
10.0.14393
A DESCRIPTION OF THE PROBLEM :
ChoiceBox events are not emited when ChoiceBox is interacted with.
Instead ComboBox events is emited.
This is either implementation bug or documentation mismatch.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create simple application:
public class StrangeBox extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Pane pane = new Pane();
ChoiceBox box = new ChoiceBox();
box.getItems().addAll("Walk", "Run");
pane.getChildren().addAll(box);
Stream.of(ChoiceBox.ON_HIDDEN, ChoiceBox.ON_HIDING, ChoiceBox.ON_SHOWING, ChoiceBox.ON_SHOWN,
ComboBox.ON_HIDDEN, ComboBox.ON_HIDING, ComboBox.ON_SHOWING, ComboBox.ON_SHOWN)
.forEach(type -> box.addEventFilter(type, event -> System.out.println(type)));
Scene scene = new Scene(pane);
primaryStage.setScene(scene);
primaryStage.setTitle("Choice box?");
primaryStage.show();
}
}
Run app fiddle with menu
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Any string in console starting with:
CHOICE_BOX_ON_
ACTUAL -
Only string starting with:
COMBO_BOX_BASE_ON_
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package ru.latuhin.choice;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import java.util.stream.Stream;
public class StrangeBox extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Pane pane = new Pane();
ChoiceBox box = new ChoiceBox();
box.getItems().addAll("Walk", "Run");
pane.getChildren().addAll(box);
Stream.of(ChoiceBox.ON_HIDDEN, ChoiceBox.ON_HIDING, ChoiceBox.ON_SHOWING, ChoiceBox.ON_SHOWN,
ComboBox.ON_HIDDEN, ComboBox.ON_HIDING, ComboBox.ON_SHOWING, ComboBox.ON_SHOWN)
.forEach(type -> box.addEventFilter(type, event -> System.out.println(type)));
Scene scene = new Scene(pane);
primaryStage.setScene(scene);
primaryStage.setTitle("Choice box?");
primaryStage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use ComboBox instead of ChoiceBox, or reregister existing ChoiceBox events to the ComboBoxBase events.
SUPPORT :
YES
java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
10.0.14393
A DESCRIPTION OF THE PROBLEM :
ChoiceBox events are not emited when ChoiceBox is interacted with.
Instead ComboBox events is emited.
This is either implementation bug or documentation mismatch.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create simple application:
public class StrangeBox extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Pane pane = new Pane();
ChoiceBox box = new ChoiceBox();
box.getItems().addAll("Walk", "Run");
pane.getChildren().addAll(box);
Stream.of(ChoiceBox.ON_HIDDEN, ChoiceBox.ON_HIDING, ChoiceBox.ON_SHOWING, ChoiceBox.ON_SHOWN,
ComboBox.ON_HIDDEN, ComboBox.ON_HIDING, ComboBox.ON_SHOWING, ComboBox.ON_SHOWN)
.forEach(type -> box.addEventFilter(type, event -> System.out.println(type)));
Scene scene = new Scene(pane);
primaryStage.setScene(scene);
primaryStage.setTitle("Choice box?");
primaryStage.show();
}
}
Run app fiddle with menu
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Any string in console starting with:
CHOICE_BOX_ON_
ACTUAL -
Only string starting with:
COMBO_BOX_BASE_ON_
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package ru.latuhin.choice;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import java.util.stream.Stream;
public class StrangeBox extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Pane pane = new Pane();
ChoiceBox box = new ChoiceBox();
box.getItems().addAll("Walk", "Run");
pane.getChildren().addAll(box);
Stream.of(ChoiceBox.ON_HIDDEN, ChoiceBox.ON_HIDING, ChoiceBox.ON_SHOWING, ChoiceBox.ON_SHOWN,
ComboBox.ON_HIDDEN, ComboBox.ON_HIDING, ComboBox.ON_SHOWING, ComboBox.ON_SHOWN)
.forEach(type -> box.addEventFilter(type, event -> System.out.println(type)));
Scene scene = new Scene(pane);
primaryStage.setScene(scene);
primaryStage.setTitle("Choice box?");
primaryStage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use ComboBox instead of ChoiceBox, or reregister existing ChoiceBox events to the ComboBoxBase events.
SUPPORT :
YES
- duplicates
-
JDK-8176267 ChoiceBox onShown\OnHidden methods don't work
-
- Closed
-
-
JDK-8176268 ChoiceBox events ON_SHOWN, ON_SHOWING, ON_HIDDEN, ON_HIDING are not fired properly
-
- Closed
-