You can use StackPane to perform the desired image match. The following code can be used in your example:
private static final ImageView iv; static { iv = new ImageView(StartPanel.class.getResource("/com/dx57dc/images/6.jpg").toExternalForm()); Text inftx = new Text("Infrastructure"); StackPane pane = new StackPane(); pane.getChildren().add(iv); pane.getChildren().add(inftx); pane.setAlignment(Pos.CENTER); }
As the StackPane tutorial reported:
The StackPane layout panel pushes all nodes on the same stack with each new node added on top of the previous node. This mock model provides an easy way to overlay text on a shape or image or overlap common shapes to create a complex shape.
source share