<Swing Dev> [9] Review request for 8136366 Add a public API to create a L&F without installation

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Fri Apr 1 11:49:09 UTC 2016


On 01/04/16 04:32, Philip Race wrote:
> > I recall that it was possible to initialize the windows l&f on linux
>
> Do you mean it was "impossible" ?
   There was a test that directly overrode isSupportedLookAndFeel() 
method to true for Windows L&F and set it on all platforms including Linux.
   We had a request to backport this fix from JDK 8 to JDK 7 but without 
explanation there it will be used:
http://mail.openjdk.java.net/pipermail/swing-dev/2013-October/003092.html

  The one reason for the current fix was to have a way to get some 
information from a L&F without installing it. May be someone wants to 
get fonts or colors from Windows L&F on Linux for its own custom L&F? It 
would be useful to allow it.

  Thanks,
  Alexandr.

>
> As far as I can tell this API lets you create (initialize) as you 
> always could
> although previously you could not get a handle to it, but with this
> change even if you can obtain the L&F you still can't install it.
> But there is a good question there .. will it fail in some way when you
> call methods on even if it is not installed it if it is not on the 
> appropriate platform ?
> Perhaps due to missing native library support ?
> If that or anything else is a concern then we should call
> isSupportedLookAndFeel() to check before returning it (and document 
> that).
> Possibly this will cause an issue for people who were doing this 
> directly on the
> unsupported platform and did not have to deal with that check, but I 
> doubt
> that anyone ought to do that anyway.
>
> So probably best to add the check.
>
> -phil.
>
> On 3/31/16, 5:07 PM, Sergey Bylokhov wrote:
>> On 31.03.16 9:50, Alexandr Scherbatiy wrote:
>>>    Some Swing L&Fs are not public. It is not possible to create them
>>> using reflection now in JDK 9 because of the modularization feature.
>>>    There are use cases when some information should be obtained from a
>>> L&F without its installation
>>>     - check if L&F is supported
>>>     - take some defaults to use it in custom L&F
>>>
>>>    The proposed solution adds UIManager.createLookAndFeel(className)
>>> method which allows to create a given L&F without installation.
>>
>> It is interesting should we allow creation of any L&F or only those 
>> which were installed and/or supported? I recall that it was possible 
>> to initialize the windows l&f on linux, Will the new method add a 
>> possibility to create it? if yes should we support that?
>>
>>




More information about the swing-dev mailing list