[External] : Re: Convenience factories for Border and Background
Kevin Rushforth
kevin.rushforth at oracle.com
Tue Jun 8 13:59:55 UTC 2021
I think that the convenience methods should just cover the most common
cases, so I'd rather skip the dotted and dashed variants. It is a good
question as to whether there ought to be a variant that takes width. I
wouldn't do that as the only method, though. I'd lean towards not taking
the width. Once you start getting into more parameters you can just use
the constructors without much more trouble.
As for the names, I have a slight preference for Border.stroke and
Background.fill.
-- Kevin
On 6/8/2021 4:25 AM, Nir Lisker wrote:
> Are dashed and dotted used frequently? I find that I only use solid
> unless I'm doing something fancy.
>
> On Tue, Jun 8, 2021 at 5:21 AM Michael Strauß <michaelstrau2 at gmail.com
> <mailto:michaelstrau2 at gmail.com>> wrote:
>
> What do you think about this variation?
>
> Border.solid(Paint color, double width) ->
> new Border(new BorderStroke(color, BorderStrokeStyle.SOLID,
> null, new BorderWidths(width)))
>
> Border.dashed(Paint color, double width) ->
> new Border(new BorderStroke(color, BorderStrokeStyle.DASHED,
> null, new BorderWidths(width)))
>
> Border.dotted(Paint color, double width) ->
> new Border(new BorderStroke(color, BorderStrokeStyle.DOTTED,
> null, new BorderWidths(width)))
>
> Background.fill(Paint color) ->
> new BackgroundFill(color, null, null)
>
> This gives developers a good deal of customizability before needing to
> fall back to using constructors.
>
>
> Am Di., 8. Juni 2021 um 03:21 Uhr schrieb Nir Lisker
> <nlisker at gmail.com <mailto:nlisker at gmail.com>>:
> >
> > 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.
> >
>
More information about the openjfx-dev
mailing list