openjfx / openjfx.github.io

https://openjfx.io
81 stars 23 forks source link

Is this behavior indicative of a bug? #81

Open xiz2008shy opened 5 months ago

xiz2008shy commented 5 months ago

The first block of code does not encapsulate the StackPane within an AnchorPane, and it results in the observed discrepancy in the corner radii:

StackPane sp = new StackPane();
//AnchorPane ap = new AnchorPane(sp);
Rectangle rectangle = new Rectangle(100.0, 100.0);
rectangle.setArcWidth(10.0);
rectangle.setArcHeight(10.0);
sp.setPrefSize(100.0, 100.0);
sp.setMaxWidth(100.0);
sp.setMaxHeight(100.0);
sp.setShape(rectangle);
sp.setClip(rectangle);
sp.setStyle("-fx-background-color: red");
Scene scene = new Scene(sp, 600.0, 700.0);
primaryStage.setScene(scene);
primaryStage.show();

like this However, when i wrap the StackPane with an AnchorPane, as shown in the second block of code, the issue appears to be resolved:

StackPane sp = new StackPane();
AnchorPane ap = new AnchorPane(sp);
Rectangle rectangle = new Rectangle(100.0, 100.0);
rectangle.setArcWidth(10.0);
rectangle.setArcHeight(10.0);
sp.setPrefSize(100.0, 100.0);
sp.setMaxWidth(100.0);
sp.setMaxHeight(100.0);
sp.setShape(rectangle);
sp.setClip(rectangle);
sp.setStyle("-fx-background-color: red");
Scene scene = new Scene(ap, 600.0, 700.0);
primaryStage.setScene(scene);
primaryStage.show();

Snipaste_2024-04-09_12-37-27

I'm wondering if this behavior is a bug in the openJFX library

xiz2008shy commented 5 months ago

Additionally, I ran it on the OpenJFX 22 version.