When starting the Test below and clicking on the ComboBox there is an unnecessary vertical ScrollBar.
I have the effect in different situations / combinations of List-lengths and Stage-sizes. Sometimes there is an unnecessary horizontal ScrollBar.
import javafx.application.Application;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.stage.Stage;
public class Test extends Application {
@Override
public void start(Stage stage) throws Exception {
ObservableList<String> items = FXCollections.observableArrayList();
ComboBox<String> comboBox = new ComboBox<String>(items);
comboBox.setPrefWidth(150);
stage.setScene(new Scene(new Group(comboBox), 300, 200));
stage.show();
Platform.runLater(() -> {
comboBox.show();
Platform.runLater(() -> {
comboBox.hide();
Platform.runLater(() -> {
items.setAll("Item 1", "Item 2", "Item 3");
});
});
});
}
public static void main(String[] args) {
launch(args);
}
}
I have the effect in different situations / combinations of List-lengths and Stage-sizes. Sometimes there is an unnecessary horizontal ScrollBar.
import javafx.application.Application;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.stage.Stage;
public class Test extends Application {
@Override
public void start(Stage stage) throws Exception {
ObservableList<String> items = FXCollections.observableArrayList();
ComboBox<String> comboBox = new ComboBox<String>(items);
comboBox.setPrefWidth(150);
stage.setScene(new Scene(new Group(comboBox), 300, 200));
stage.show();
Platform.runLater(() -> {
comboBox.show();
Platform.runLater(() -> {
comboBox.hide();
Platform.runLater(() -> {
items.setAll("Item 1", "Item 2", "Item 3");
});
});
});
}
public static void main(String[] args) {
launch(args);
}
}