On Thu, 22 Jan 2026 03:56:30 GMT, Michael Strauß <[email protected]> wrote:

>> Could perhaps the scene preferences be used for things like this? E.g. 
>> similar to having access to the platform styling keys, a user could manually 
>> override some of them to achieve the same result as with enums. That would 
>> solve any potential parameters and the degradation problem better
>
> I'm not sure about scene preferences, as the supported backdrop materials are 
> not exactly a _preference_. It's not something users can change about the 
> system.
> 
> How about something like this:
> 
> public sealed interface StageBackdrop {
> 
>     enum Generic implements StageBackdrop {
>         DEFAULT,
>         WINDOW,
>         TABBED,
>         TRANSIENT
>     }
> 
>     record Specialized(String name, Map<String, Object> parameters) 
> implements StageBackdrop {
>         public Specialized(String name) {
>             this(name, Map.of());
>         }
>     }
> }
> 
> 
> 
> public class Stage {
> 
>     public final void initBackdrop(StageBackdrop... backdrop) {
>         ...
>     }
> }
> 
> 
> The `initBackdrop` method would take a list of options in order of 
> preference. Maybe I could then configure my backdrop like so:
> 
> myStage.initBackdrop(
>     // first choice
>     new StageBackdrop.Specialized(
>         "NSGlassEffect",
>         Map.of("style", "NSGlassEffectViewStyleClear")
>     ),
> 
>     // second choice
>     StageBackdrop.Generic.TRANSIENT
> );

Should we have a (new kind of) fallback system, or should we do this with the 
existing `Platform.isSupported(ConditionalFeature)` and have the user decide 
based on the result of that function?

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/2048#discussion_r2716542068

Reply via email to