Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Rectangle transparent

I need to make a drawn rectangle mouse transparent, in order to see the desktop. The following code draws my rectangle. What should I add to get that ? Thanks for help

public void start(Stage primaryStage) {
    Group group = new Group();

    Rectangle rect = new Rectangle(20,20,200,200);

    rect.setArcHeight(15);
    rect.setArcWidth(15);

    rect.setStroke(Color.BLACK);
    group.getChildren().add(rect);

    Scene scene = new Scene(group, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}
like image 476
Stéphane GROSSMANN Avatar asked Oct 06 '14 18:10

Stéphane GROSSMANN


1 Answers

If you just want the interior of the rectangle to be transparent, then all you need is

rect.setFill(Color.TRANSPARENT);

but I'm not quite sure if this is what you mean.

like image 89
James_D Avatar answered Nov 10 '22 08:11

James_D