[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-openjfx-dev
Subject: =?UTF-8?Q?Aw=3A=C2=A0Re=3A_Convenience_factori?= =?UTF-8?Q?es_for_Border_and_Background?=
From: Marius Hanl <mariushanl () web ! de>
Date: 2021-08-24 15:57:42
Message-ID: trinity-e83f587e-e772-4d50-8059-e29b879d8b38-1629820662364 () msvc-mesg-web106
[Download RAW message or body]
I want to see this as well.
Do we want to continue creating a draft for this?
Am 23.08.21, 01:48 schrieb Nir Lisker <nlisker@gmail.com>:
Getting this moving again as well.
> 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)
This is possible, but I don't think it saves much. This API in Color
makes
it easy to create a color, so just using that directly in the
border/background seems convenient enough to me. Comparing
Border.rgb(125, 100, 75);
with
Border.of(Color.rgb(125, 100, 75)); // whatever the method name ends
up
being
tells me that funneling all the color creation ways into one method
in
border/background is efficient enough to not merit multiple methods.
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.
I rather not duplicate hundreds of constants just to be able to do
pane.setBorder(Border.RED);
instead of
pane.setBorder(Border.of(Color.RED));
On Tue, Jun 8, 2021 at 2:41 AM Nir Lisker <nlisker@gmail.com> wrote:
> Does this constitute sufficient interest in the enhancement?
>
> On Thu, May 13, 2021 at 6:41 PM Michael Strauß
<michaelstrau2@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.
>>
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic