I am trying to make a window that is transparent but I can still draw on and the drawings are not transparent. If i put opacity on the stage it makes everything transparent. I also have tried adding a transparency to the group but that doesn't seem to change anything. How can i accomplish this?
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
DisplayMode displayMode = gd.getDisplayMode();
Canvas canvas = new Canvas(displayMode.getWidth(), displayMode.getHeight());
GraphicsContext gc = canvas.getGraphicsContext2D();
Group group = new Group();
group.getChildren().add(canvas);
Scene secondScene = new Scene(group, displayMode.getWidth(), displayMode.getHeight());
gc.setFill(Color.rgb(0, 0, 0, .5));
gc.fillRect(0, 0, 100, 100);
// New window (Stage)
Stage newWindow = new Stage(StageStyle.UNDECORATED);
newWindow.setOpacity(.02);
newWindow.setTitle("Second Stage");
newWindow.setScene(secondScene);
// Set position of second window, related to primary window.
newWindow.setX(0);
newWindow.setY(0);
//newWindow.setWidth(displayMode.getWidth());
//newWindow.setHeight(displayMode.getHeight());
newWindow.show();