user4456449
user4456449

Reputation: 41

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

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 ........

Upvotes: 2

Views: 4312

Answers (2)

Steven Van Impe
Steven Van Impe

Reputation: 1173

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);
    }
}

Upvotes: 5

tomsontom
tomsontom

Reputation: 5897

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

Upvotes: 1

Related Questions