Difference between revisions of "Set all Java apps to use GTK+ font & theme settings"

From Manjaro
Jump to navigation Jump to search
imported>Dalto
(Moved links to See Also section & general cleanup)
(Updated style and added translate tags)
Line 1: Line 1:
=Introduction=
+
<languages/>
 +
__TOC__
  
 +
{{SectionTemplate|<translate>Introduction</translate>|2=
 
This fix makes your Java apps use your GTK+ theme (colours & such) & your chosen font settings. Here is how it looks like:
 
This fix makes your Java apps use your GTK+ theme (colours & such) & your chosen font settings. Here is how it looks like:
  
<div><ul>
+
{{FlexSideContainerTemplate|
<li style="display: inline-block;"> [[File:Java_default_look.png|thumb|none|400px|Before the fix]] </li>
+
[[File:Java_default_look.png|thumb|none|400px|Before the fix]]
<li style="display: inline-block;"> [[File:Java_GTK+_look.png|thumb|none|400px|After the fix]] </li>
+
|
</ul></div>
+
[[File:Java_GTK_look.png|thumb|none|400px|After the fix]]
 
+
|1|1}}}}
<br clear="all"/>
 
 
 
=How do you do it?=
 
  
 +
{{SectionTemplate|<translate>How do you do it?</translate>|2=
 +
<translate>
 
Set the variable '''_JAVA_OPTIONS''' by running this command in a terminal:
 
Set the variable '''_JAVA_OPTIONS''' by running this command in a terminal:
  
Line 21: Line 22:
  
 
Append the above definition of the '''_JAVA_OPTIONS''' variable to '''~/.profile''' (for your user only) or '''/etc/profile.d/90-java_ops.sh''' (system-wide). In both cases, if the file does not exist, create it.
 
Append the above definition of the '''_JAVA_OPTIONS''' variable to '''~/.profile''' (for your user only) or '''/etc/profile.d/90-java_ops.sh''' (system-wide). In both cases, if the file does not exist, create it.
 +
</translate>
 +
}}
  
 
+
{{SectionTemplate|<translate>See Also</translate>|
=See Also=
 
 
 
 
* [http://askubuntu.com/questions/21886/how-can-i-get-a-java-apps-to-use-the-gtk-theme How can I get a java apps to use the GTK+ theme?(askubuntu)]
 
* [http://askubuntu.com/questions/21886/how-can-i-get-a-java-apps-to-use-the-gtk-theme How can I get a java apps to use the GTK+ theme?(askubuntu)]
* Related [https://forum.manjaro.org/t/wiki-set-all-java-apps-to-use-gtk-font-theme-settings/19305 forum post]
+
* Related [https://forum.manjaro.org/t/wiki-set-all-java-apps-to-use-gtk-font-theme-settings/19305 forum post]|Chmsee-icon.png}}
 
 
<br clear="all"/>
 
  
[[Category:Contents Page]]
+
[[Category:Contents Page{{#translation:}}]]

Revision as of 10:01, 19 December 2020

Other languages:
English



Introduction

This fix makes your Java apps use your GTK+ theme (colours & such) & your chosen font settings. Here is how it looks like:


Before the fix




How do you do it?

Set the variable _JAVA_OPTIONS by running this command in a terminal:

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}"

First test to see if the outcome is what you expect by running your Java app from the same terminal window.

If the result looks good to you, let us make the changes permanent:

Append the above definition of the _JAVA_OPTIONS variable to ~/.profile (for your user only) or /etc/profile.d/90-java_ops.sh (system-wide). In both cases, if the file does not exist, create it.