atlantafx icon indicating copy to clipboard operation
atlantafx copied to clipboard

ComboBox items are shown in wrong position when they are above ComboBox

Open PavelTurk opened this issue 9 months ago • 0 comments

Run the following code:

public class JavaFxTest7 extends Application {

    @Override
    public void start(Stage stage) {
        Application.setUserAgentStylesheet(new Dracula().getUserAgentStylesheet());
        var items = FXCollections.observableArrayList(List.of("a", "b"));
        var combobox = new ComboBox<String>();
        combobox.setItems(items);

        var vBox = new VBox(combobox);
        vBox.setStyle("-fx-font-size: 15");
        vBox.setAlignment(Pos.BOTTOM_LEFT);

        Scene scene = new Scene(vBox, 600, 200);
        stage.setScene(scene);
        stage.show();
        stage.setMaximized(true);
    }

    public static void main(String[] args) {
        launch();
    }
}

And you will get this result:

Peek 2024-05-23 12-42

As you see when you click it the fist time, then there is a space between the comboBox and items. The size of this space depends on the font size. At the same time, when you click the second time, then there is no such space.

When I use pure JavaFX (without atlantafx), then everything is OK:

Peek 2024-05-23 12-41

PavelTurk avatar May 23 '24 09:05 PavelTurk