If you run the test case below, at least on a Mac, when scrolling up and down the choicebox you will sometimes get large empty areas at the top and bottom as shown in the attached screen shot. The error occurs when the scrolling arrives at the very top of the choice box list - instead of only showing the first element, empty space is shown above it. Similarly when arriving at the bottom of the list - instead of only showing the last element, empty space is shown below the last element. For some reason the empty area is larger at the top than at the bottom.
public class ChoiceBoxBug extends Application {
private ChoiceBox choiceBox = new ChoiceBox();
@Override
public void start(Stage stage) throws Exception {
BorderPane borderPane = new BorderPane();
borderPane.setTop(choiceBox);
List<String> longList = new ArrayList();
for(int i = 0; i < 100; i++) {
longList.add("Item number " + i);
}
choiceBox.getItems().setAll(longList);
stage.setWidth(300);
stage.setScene(new Scene(borderPane));
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
public class ChoiceBoxBug extends Application {
private ChoiceBox choiceBox = new ChoiceBox();
@Override
public void start(Stage stage) throws Exception {
BorderPane borderPane = new BorderPane();
borderPane.setTop(choiceBox);
List<String> longList = new ArrayList();
for(int i = 0; i < 100; i++) {
longList.add("Item number " + i);
}
choiceBox.getItems().setAll(longList);
stage.setWidth(300);
stage.setScene(new Scene(borderPane));
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}