You are not logged in.

#1 2017-10-07 10:03:47

Davy
Member
From: Ireland
Registered: 2016-05-31
Posts: 65
Website

[SOLVED] How do I change java System Look and Feel for my system?

In java:

UIManager.getSystemLookAndFeelClassName()

returns javax.swing.plaf.metal.MetalLookAndFeel instead of com.sun.java.swing.plaf.gtk.GTKLookAndFeel as it should do on Linux. I've changed swing.properties in my java-8-openjdk folder to

swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel

so it defaults to GTK laf regardless, but it's still rather annoying that

UIManager.getSystemLookAndFeelClassName()

still doesn't return the GTK laf, because I use

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

so my program will work on other computers, but of course for me, that returns the Metal laf, which then overrides the Default laf, which I have set to GTK.

So, in short, is there a setting somewhere where I can change what the System look and feel (as in the string which returns when I call the above method) to com.sun.java.swing.plaf.gtk.GTKLookAndFeel

I hope I've been clear, any help would be much appreciated.

Davy

Last edited by Davy (2017-10-08 21:48:45)

Offline

#2 2017-10-07 10:42:35

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: [SOLVED] How do I change java System Look and Feel for my system?

Davy wrote:

is there a setting somewhere where I can change what the System look and feel (as in the string which returns when I call the above method) to com.sun.java.swing.plaf.gtk.GTKLookAndFeel

I'm not really familiar with Java but this Stack Exchange thread says that you can export the values to the global environment.

To do this in a stock BunsenLabs desktop then add the export line(s) to the file at ~/.xsessionrc

If the display manager (graphical login screen) is dropped then ~/.profile should be used instead, that file is also parsed for TTY (console) logins.

Offline

#3 2017-10-08 07:34:22

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: [SOLVED] How do I change java System Look and Feel for my system?

archwiki also has good info on java (also note the 2 more articles on the right-hand side).

Offline

#4 2017-10-08 21:47:33

Davy
Member
From: Ireland
Registered: 2016-05-31
Posts: 65
Website

Re: [SOLVED] How do I change java System Look and Feel for my system?

Marvellous! I've now added

export _JAVA_OPTIONS='-Dswing.systemlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'

to my .xsessionrc file. It's exactly what I needed. UIManager.getSystemLookAndFeelClassName() now no longer returns javax.swing.plaf.metal.MetalLookAndFeel. Instead it now returns com.sun.java.swing.plaf.gtk.GTKLookAndFeel like it should for Linux. Thank you very much!

Edit: reading further on that Archwiki page I found a fix for a very specific bug I had encountered in the past few days. A very happy coincidence.

Last edited by Davy (2017-10-08 22:11:13)

Offline

#5 2017-10-09 05:53:46

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: [SOLVED] How do I change java System Look and Feel for my system?

Great news, thanks for reporting back smile

Offline

Board footer

Powered by FluxBB