Hi Nir, this is a really good idea and something I want to see since the first time I used to set a Background/Border. I think a minimal constructor would be a nice first step. So instead of:
- setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY))) -> setBackground(new Background(new BackgroundFill(Color.BLACK))) and: - setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderStroke.DEFAULT_WIDTHS))) -> setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID))) We may can go further from that and create something similar like the BorderFactory class in swing, where you can create a lot of different borders easily. (Same to Background) Reference: [1]https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/cl asses/javax/swing/BorderFactory.java - Marius Gesendet: Donnerstag, 22. April 2021 um 15:45 Uhr Von: "Nir Lisker" <nlis...@gmail.com> An: "openjfx-dev@openjdk.java.net Mailing" <openjfx-dev@openjdk.java.net> Betreff: Convenience factories for Border and Background Hi, Many times when I want to create a simple solid Background or Border, it is quite a hassle because of the configurability these classes have: new Border(new BorderStroke(Color. BLACK, BorderStrokeStyle.SOLID, null, null)); new Background(new BackgroundFill(Color.BLACK, null, null)); I was thinking of adding convenience factory methods Border.of(Paint stroke), or Border.stroke(Paint stroke) Background.of((Paint fill), or Background.fill(Paint fill) I was wondering if others would like this, or is everyone using CSS anyway? - Nir References 1. https://deref-web.de/mail/client/sT3TQpQ3T6k/dereferrer/?redirectUrl=https%3A%2F%2Fgithub.com%2Fopenjdk%2Fjdk%2Fblob%2Fmaster%2Fsrc%2Fjava.desktop%2Fshare%2Fclasses%2Fjavax%2Fswing%2FBorderFactory.java