[Bug 1581835] Re: Native Look and Feel for Swing does not work

Tiago Stürmer Daitx 1581835 at bugs.launchpad.net
Mon May 16 23:23:59 UTC 2016

On Mon, May 16, 2016 at 3:40 PM, Yanpas <yanp.bugz at gmail.com> wrote:
> Thanks for an answer!
> I've got the principle of work. You've marked my bug as invalid - Is it
> possible to see gtk laf on non-gnome DEs by default ? (I guess this
> question should be adressed to openjdk developers). When will ubuntu
> packages of openjdk be shiped with gtk laf by default? (which bugs
> should I follow to track the status).

It is possible, but it requires changes on OpenJDK itself. The best
way to resolve this is to discuss the issue directly on the OpenJDK
mailing list. Still, there are a lot of bug reports everywhere when
GTK LAF is used by default due to applications mixing GTK2 and GTK3
calls. I'm not aware if this has been fixed recently or is still an
issue, again it is something to be discussed on the OpenJDK side.

Unless it is clear that GTK is safe to be used and we have good
heuristics in place to know when we must avoid it, we will not enable
GTK by default. There are no bugs tracking this on Ubuntu AFAIK, I
have put this bug back as a confirmed for now and will ask someone to
set its priority to Wishlist. We can track progress that way.

> And what will be the rules when
> the bugs will be fixed? I imagine like this:
> On Gnome DE (Gnome and Unity7): default LAF is gtk, using
> UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) will
> make LAF "GTK"
> On non-gnome DE (Xfce e. g.): default LAF is gtk, using
> UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) will
> make LAF "SilverBlue".

The SilverBlue is called Metal LAF.

> The last one seems to be controversial. Avoiding of usage setLookAndFeel
> will cause my app to look SilverBlue on Win/OSX and Native on Linux :)

This is weird, the systemlaf is set to
com.sun.java.swing.plaf.windows.WindowsLookAndFeel on Windows and
com.apple.laf.AquaLookAndFeel on OSX. Apart from a systemlaf being set
I have no idea why it would be using Metal instead on Windows and OSX.

> I am able to rewrite my code, but there are apps like Yed, Logisim which
> use setLookAndFeel, they look native everywhere except Ubuntu :(

Again, the best way would be for OpenJDK to allow us to set that on
the swing.properties file. This way users could edit the file to set
what LAF to use when
gets called.

** Changed in: openjdk-7 (Ubuntu)
       Status: Invalid => Confirmed

** Changed in: openjdk-8 (Ubuntu)
       Status: Invalid => Confirmed

You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to openjdk-8 in Ubuntu.

  Enable native GTK Look and Feel for non-gnome desktops

Status in openjdk-7 package in Ubuntu:
Status in openjdk-8 package in Ubuntu:

Bug description:
  Openjdk-7 and openjdk-8 do not enable native look and feel by default. But they support it. Apps use ugly blue theme, even if the code contains "UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());"
  I've tried Xubuntu 14.04, Ubuntu Mate 16.04 - apps look ugly. (for example logisim)

  To get native LAF you need to use these arguments: _JAVA_OPTIONS 
  -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel

To manage notifications about this bug go to:

More information about the foundations-bugs mailing list