In javaFx is it possible to make rounded corner of a Rectangle except right-bottom?

4k views Asked by At

Its too easy to make all corner round by using archWidth() and archHeight().
But I need only top-left, top-right and left-bottom corner round. I need to display image where image have top-left, top-right and left-bottom rounded corner. please help me ........

2

There are 2 answers

0
tomsontom On

Use a Region instead it allows to define background-radius values for each corner

3
Steven Van Impe On

If you use a Region, you can set the backgroud radii in CSS:

public class FXRadiusTest extends Application
{
    @Override
    public void start(Stage stage)
    {
        Region rect = new Region();
        rect.setPrefSize(200, 200);
        rect.setStyle("-fx-background-color: red; -fx-background-radius: 10 10 0 10");
        stage.setScene(new Scene(new Group(rect), 400, 400));
        stage.show();
    }

    public static void main(String... args)
    {
        Application.launch(FXRadiusTest.class, args);
    }
}