<Swing Dev> Native look and feel on linux [2]

Alexey Ivanov alexey.ivanov at oracle.com
Mon May 30 13:16:00 UTC 2016


Hi Yan,

If your application sets LaF explicitly in the code, you cannot override 
it with swing.properties.

The Look-and-Feel set using swing.properties file or 
-Dswing.systemlaf=<LaF-class> will change the default LaF used by Swing 
apps. For example, Swing uses Metal Look-and-Feel by default on Linux 
platform: If the application does not explicitly set its LaF, the app 
will be displayed in Metal LaF. If you change 'swing.systemlaf' property 
to GTK, the application will use GTK LaF.

If the application explicitly sets its Look-and-Feel at runtime, then 
that application will be run using the LaF it set. You cannot change it.


Regards,
Alexey

On 28.05.2016 0:41, Yan wrote:
>> You can put swing.properties file to <JRE>/lib directory as described
> here:
> https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html#properties
>> The contents of the file would be:
>>
>> swing.systemlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
>>
>> This property file will set GTK LaF for all applications that use this
> JRE to run.
>
> High! I've did what you've said, placed file with this line in
> /usr/lib/jvm/java-7-openjdk-amd64/lib/ , but nothing have changed. Maybe
> I do wrong something?
>
> Once again, I have simple java app, which sets LAF using this:
> UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
> and I have no env variables like _JAVA_OPTIONS
>
> Regards, Yan




More information about the swing-dev mailing list