On Wed, 28 Sep 2022 09:08:04 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

>>> You should probably call `setLookAndFeel` on the main thread, or you should 
>>> call `UIManager.get` below on the EDT as well.
>> 
>> In fact, I was inclined to use the main thread, it produces a shorter stack 
>> trace. EDT is okay, no change is required if you don't feel like it.
>
> Normally, many tests does this only which is what I did initially..
> 
> public static void main(String[] args) throws Exception {
>     for (UIManager.LookAndFeelInfo laf : 
> UIManager.getInstalledLookAndFeels()) {
>             System.out.println("Testing l&f : " + laf.getClassName());
>             SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
> 
> 
> but I guess the present one will suffice too...

My initial concern was that you use two different threads where you shouldn't. 
I would rather use the main thread for all operations in this particular case. 
As long as setting the LaF and reading the properties are on the same thread, 
we're safe.

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

PR: https://git.openjdk.org/jdk/pull/10035

Reply via email to