[REVIEW REQUEST] RT-19713 Add API to JavaFX to allow for setting preferred user agent stylesheet

Tom Eugelink tbee at tbee.org
Thu Nov 22 10:48:06 PST 2012


Equally as important, now that we're discussing new styles, is that it should be easy for 3rd party controls to adopt to the new styling. There has to be some notion of "apply the focus styling", "apply the highlight styling" in the CSS.

Tom



On 2012-11-21 22:29, Jonathan Giles wrote:
> I think the comment in Jaspers code is very important to pull out and highlight, as what he says in the javadoc comment is exactly what I want. In short, my personal preference is to push for JavaFX to upgrade to new user agent stylesheets _by default_. I mentioned this issue in RT-19713, but I'm keen to discuss this more widely.
>
> The benefit of this approach is that it would prevent the issue we had in Swing where the default look remained as Metal forever - which didn't really help Swing take the world by storm. Many months ago Jasper started investigating a new CSS style and I was helping to give feedback. The reason I mention this is that immediately the new style made the current Caspian style look dated and heavy, in my opinion (which is pretty impressive as Caspian doesn't look bad by any means). I would upgrade my personal applications to the new look in a heartbeat, and I would love to have all JavaFX applications upgrade to this as well - rather than be stuck on Caspian.
>
> Of course, just because we update by default doesn't mean that this is what people necessarily want for their software - they want to be certain we don't break their apps when the styles change. To allow for this, developers would have to explicitly state (using the API Jasper has outlined below) what style they want to use.
>
> In other words, I would like us to switch from opt-in to opt-out (of new styles), and I'd be very keen to hear feedback on this in conjunction with the feedback Jasper is seeking.
>
> -- Jonathan
>
> On 22/11/2012 10:09 a.m., Jasper Potts wrote:
>> Hi All,
>>
>> I would like to add API to Application to add the ability to set the default user agent stylesheet. So far JavaFX has had a default stylesheet of capsian.css hard coded for all applications. In 8 if we have time I would like to have a new stylesheet that you can use as alternative to caspian.css. This would also open the platform to easy use of 3rd party look and feels.
>>
>> public abstract class Application {
>> ….
>>      /**
>>       * Set the default user agent stylesheet. This is used to provide default
>>       * styling for all ui controls and other nodes. Each release of JavaFX may
>>       * have a new default value for this so if you need to guarantee consistency
>>       * you will need to call this method and choose what default you would like
>>       * for your application.
>>       *
>>       * @param url The URL to the stylesheet as a String.
>>       */
>>      public static void setDefaultUserAgentStylesheet(String url) ….
>> …..
>> }
>>
>> This has been a much requested feature for a long time:
>> http://javafx-jira.kenai.com/browse/RT-8054
>> http://javafx-jira.kenai.com/browse/RT-5753
>> http://javafx-jira.kenai.com/browse/RT-19713
>>
>> There have been some workarounds for specific use cases and a proposed solution for a Theme class but none have solved the root problem of being able to change the default user agent stylesheet.
>>
>> Thanks
>>
>> Jasper
>



More information about the openjfx-dev mailing list