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 ........
Asked
Active
Viewed 3,736 times
2

Konrad Krakowiak
- 12,285
- 11
- 58
- 45

user4456449
- 41
- 1
- 4
-
https://stackoverflow.com/questions/72949214/javafx-image-with-different-corners solves the problem of having different corners in an image simultaneously. – Trizion Jul 14 '22 at 07:45
2 Answers
4
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);
}
}

Steven Van Impe
- 1,153
- 8
- 15
-
thanks.....its good but how can i add image into it.actually i need an image with top-left, top-right,left-bottom round corner. – user4456449 Jun 09 '15 at 11:01
-
Regions can contain background images with [-fx-background-image](https://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html#region). – jewelsea Jun 09 '15 at 11:14
-
1
0
Use a Region instead it allows to define background-radius values for each corner

tomsontom
- 5,856
- 2
- 23
- 21