[External] : Re: Convenience factories for Border and Background
Nir Lisker
nlisker at gmail.com
Wed Jun 9 00:22:18 UTC 2021
>
> (Though to be honest for my larger projects most of the time this stuff is
> set in a style sheet. It’s smaller tools and utilities that I find this
> particularly tedious as the verbosity of the code becomes annoying.)
>
This was exactly my original question. If people use css most for most
cases, what do the small tools and utilities use? Width I can understand,
but is radius common enough for simple cases?
On Tue, Jun 8, 2021 at 6:47 PM Scott Palmer <swpalmer at gmail.com> wrote:
> +1 for having a variant that takes a width. Colour, width, and radius are
> the main parameters I need, so a variant that takes all three would help:
>
> Border.stroke(Paint p, double width, double radii)
>
> (Though to be honest for my larger projects most of the time this stuff is
> set in a style sheet. It’s smaller tools and utilities that I find this
> particularly tedious as the verbosity of the code becomes annoying.)
>
> Scott
>
> > On Jun 8, 2021, at 9:59 AM, Kevin Rushforth <kevin.rushforth at oracle.com>
> wrote:
> >
> > 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