Skip to main content
  1. Posts/

Enhance Java App Appearance with GTK+ Font & Theme Settings

115 words·1 min· loading · loading ·
linux-talk theme JavaUI GTK+

If you find your Java applications lacking visual appeal and wish to synchronize them with GTK theme styles and font settings, you’ve come to the right place. Let’s accomplish this together!

To achieve this, you need to set an environment variable. For Bash or Zsh

Test the effectiveness of this solution by executing the following command:

bash

export _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 ${_JAVA_OPTIONS}"

For a permanent change, add the above definition of the _JAVA_OPTIONS variable to ~/.profile (for your user only) or /etc/profile.d/90-java_ops.sh (system-wide). For Fish Shell

fish


set -Ux _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" $_JAVA_OPTIONS

If everything goes smoothly, your previously unattractive Java applications should now adopt GTK theme components, greatly enhancing their appearance.