Skip to content

Element.hasChildren() gives wrong result #16

@PavelTurk

Description

@PavelTurk

This is test code:

public class TestFx extends Application {

    @Override
    public void start(Stage stage) {
        var button = new Button("Test");
        var hBox = new HBox(button);
        VBox root = new VBox(hBox);
        button.setOnAction(e -> {
            var element = LocalElement.of(stage, new EventSource(null, stage.hashCode(), true));
            var child = element.getChildren().get(0);
            System.out.println("hasChildren() : " + child.hasChildren());
            System.out.println("getChildren().size() : " + child.getChildren().size());
        });
        Scene scene = new Scene(new StackPane(root), 400, 400);
        stage.setScene(scene);
        stage.show();
    }

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

If you run the code and click the button you will get this output

hasChildren() : false
getChildren().size() : 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions