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

Jasper Potts jasper.potts at oracle.com
Wed Nov 21 14:13:42 PST 2012


Daniel I agree that a system property for this would be nice and think we should add one before switching the default (I have filed a issue http://javafx-jira.kenai.com/browse/RT-26435 to track). At the moment I want to make a start with a API to switch so that I can have a application for development and testing of the new look and feel that replaces caspian with its own look. At the moment there is no proper way of doing that.

Jasper

On Nov 21, 2012, at 2:04 PM, Daniel Zwolenski <zonski at gmail.com> wrote:

> reply-all got me again...
> 
> 
> On Thu, Nov 22, 2012 at 8:58 AM, Daniel Zwolenski <zonski at gmail.com> wrote:
> 
>> +1 to the idea.
>> 
>> I'm wondering if it's worth having some sort of System property (or
>> something similar if System properties are bad form) that could set the
>> default stylesheet as well if none has been explicitly set by the
>> developer. That way if I forgot to specifically link my app to a default
>> style sheet and then 12 months later a new release of Java causes me
>> problems I could at least set the style via a system property rather than
>> having to get back into my old code, change it, recompile, redeploy, etc.
>> Applets and JNLP are the prime problem children for the auto-updating
>> issues so anything that could be set in the HTML or JNLP to change the
>> style would do the job in my opinion.
>> 
>> Also more just thinking out loud, but some build tool support for this
>> might be interesting. e.g. the native installers, and/or jnlp files could
>> bundle in a default style per OS or something (and Maven could just use
>> convention to look for the existence of say a default-win32-style.css vs a
>> -osx, etc).
>> 
>> 
>> 
>> 
>> On Thu, Nov 22, 2012 at 8:38 AM, Jim Weaver <james.weaver at oracle.com>wrote:
>> 
>>> +1.
>>> 
>>> Thanks,
>>> Jim Weaver
>>> 
>>> 
>>> On 11/21/12 4:09 PM, 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-8054>
>>>> http://javafx-jira.kenai.com/**browse/RT-5753<http://javafx-jira.kenai.com/browse/RT-5753>
>>>> http://javafx-jira.kenai.com/**browse/RT-19713<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
>>>> 
>>> 
>>> 
>>> --
>>> Regards,
>>> Jim Weaver
>>> Java Evangelist
>>> Oracle Corporation
>>> james.weaver at oracle.com
>>> 
>>> 
>> 



More information about the openjfx-dev mailing list