The new API: 1. `Border.of(Paint stroke)` or `Border.stroke(Paint stroke)` that does `new Border(new BorderStroke(Paint stroke , BorderStrokeStyle.SOLID, null, null));` 2. `Background.of((Paint fill)` or `Background.fill(Paint fill)` that does `new Background(new BackgroundFill(Paint fill, null, null));`
I don't mind either name choice. On Tue, Jun 8, 2021 at 2:50 AM Kevin Rushforth <kevin.rushfo...@oracle.com> wrote: > If I recall, there were a few developers that chimed in. It's a simple > enough addition -- at least your original proposal (not the suggestion of > mirroring the Color API, which I don't like) -- that it seems OK to me. > > Can you repost your currently proposed API and see if those who might like > to use it are satisfied with it? > > -- Kevin > > > On 6/7/2021 4:41 PM, Nir Lisker wrote: > > Does this constitute sufficient interest in the enhancement? > > On Thu, May 13, 2021 at 6:41 PM Michael Strauß <michaelstr...@gmail.com> > wrote: > >> Another option could be to mirror the `Color` API in both `Border` and >> `Background`, like in the following examples: >> >> Color.rgb(125, 100, 75) >> Border.rgb(125, 100, 75) >> Background.rgb(125, 100, 75) >> >> Color.gray(127) >> Border.gray(127) >> Background.gray(127) >> >> Color.web("orange", 0.5) >> Border.web("orange", 0.5) >> Background.web("orange", 0.5) >> >> We could also mirror the named color constants, which would enable a >> very compact syntax: >> >> StackPane pane = new StackPane(); >> pane.setBorder(Border.RED); >> pane.setBackground(Background.BLUE); >> >> This is very similar to how "red" or "blue" are valid values for >> "-fx-border" or "-fx-background" in CSS. >> > >