0

I am trying to get a rectangle's background color. I tried to find a way but i couldnt. Isnt there a method makes all this easy? Any help would be appriciated

2 Answers2

1

Try this way

List<Node> chieldNode = new ArrayList<>();
    chieldNode = ParentNode.getChildren();
    if (chieldNode.size() != 0) {
        for (Node node : chieldNode) {
            if (node instanceof Rectangle ) {
                Paint color = ((Rectangle ) node).getFill();
            }
        }
    }
Keyur Bhanderi
  • 1,524
  • 1
  • 11
  • 17
0

This worked for me

    Rectangle rectangle = lookup("#rectangleId").queryAll().iterator().next();
    Paint color = rect.getFill();
    assertThat(color,is(color2));