← Back to team overview

openjdk team mailing list archive

[Bug 1581835] Re: Enable native GTK Look and Feel for non-gnome desktops

 

** Description changed:

- 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)
+ The default System LAF - ie. UIManager.getSystemLookAndFeelClassName() -
+ on Linux is set to GTK for gnome desktop - ie. sun.desktop returns gnome
+ - and to Metal for non-gnome desktops.
  
- 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
+ This prevents the majority of Java applications to use the native GTK
+ LAF when running.
+ 
+ Also, UIManager.getSystemLookAndFeelClassName() ignores the default LAF
+ set by the user through swing.defaultlaf (either as a system property or
+ in swing.properties), relying instead on it's own simplified OS/Desktop
+ based heuristics and defaulting to the Cross Platform LAF when those
+ heuristics fail.
+ 
+ While the Default LAF can be set either as a system property or in
+ swing.properties, the System LAF can only be set as as system property,
+ thus there is no way to assign it system-wide.
+ 
+ Historically the GTK LAF was a source of bugs and errors. It is unclear
+ if the situation has improved at all in the past few years.
+ 
+ = Workaround =
+ 
+ Currently there are only 2 alternatives to set GTK LAF system wide, both
+ rely on editing the swing.properties file, depending on whether the Java
+ application calls
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()):
+ 
+ 1) For applications that *don't* use it then add
+ swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel to
+ swing.properties
+ 
+ 2) For applications that use it then add
+ swing.installedlafs=com.sun.java.swing.plaf.gtk.GTKLookAndFeel to
+ swing.properties

-- 
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-7 in Ubuntu.
https://bugs.launchpad.net/bugs/1581835

Title:
  Enable native GTK Look and Feel for non-gnome desktops

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

Bug description:
  The default System LAF - ie. UIManager.getSystemLookAndFeelClassName()
  - on Linux is set to GTK for gnome desktop - ie. sun.desktop returns
  gnome - and to Metal for non-gnome desktops.

  This prevents the majority of Java applications to use the native GTK
  LAF when running.

  Also, UIManager.getSystemLookAndFeelClassName() ignores the default
  LAF set by the user through swing.defaultlaf (either as a system
  property or in swing.properties), relying instead on it's own
  simplified OS/Desktop  based heuristics and defaulting to the Cross
  Platform LAF when those heuristics fail.

  While the Default LAF can be set either as a system property or in
  swing.properties, the System LAF can only be set as as system
  property, thus there is no way to assign it system-wide.

  Historically the GTK LAF was a source of bugs and errors. It is
  unclear if the situation has improved at all in the past few years.

  = Workaround =

  Currently there are only 2 alternatives to set GTK LAF system wide,
  both rely on editing the swing.properties file, depending on whether
  the Java application calls
  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()):

  1) For applications that *don't* use it then add
  swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel to
  swing.properties

  2) For applications that use it then add
  swing.installedlafs=com.sun.java.swing.plaf.gtk.GTKLookAndFeel to
  swing.properties

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openjdk-7/+bug/1581835/+subscriptions


References