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

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

From Manjaro
imported>Photon
(Created page)
 
(Marked this version for translation)
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
=Introduction=
<languages/>
__TOC__


This fix makes your Java apps use your GTK+ theme (colours & such) & your chosen font settings.
{{SectionTemplate|<translate><!--T:1--> Introduction</translate>|2=
<translate>
<!--T:10-->
This fix makes your Java apps use your GTK+ theme (colours & such) & your chosen font settings. Here is how it looks like:


<br clear="all"/>
<!--T:11-->
{{FlexSideContainerTemplate|
[[File:Java_default_look.png|thumb|none|400px|Before the fix]]
|
[[File:Java_GTK_look.png|thumb|none|400px|After the fix]]
|1|1}}
</translate>}}


=How do you do it?=
{{SectionTemplate|<translate><!--T:2--> How do you do it?</translate>|2=
<translate>
<!--T:3-->
Set the variable '''_JAVA_OPTIONS''' by running this command in a terminal:


First try if the outcome is what you expect:  
<!--T:4-->
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}"


1) Set the variable '''_JAVA_OPTIONS''' accordingly:
<!--T:5-->
 
First test to see if the outcome is what you expect by running your Java app from the same terminal window.
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'
 
2) Run your Java app from the same terminal window.


<!--T:6-->
If the result looks good to you, let us make the changes permanent:
If the result looks good to you, let us make the changes permanent:


1) Append the above definition of the '''_JAVA_OPTIONS''' variable to '''~/.profile''' (for your user only) or '''/etc/profile''' (system-wide). If the file does not exist, create it.
<!--T:7-->
 
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.
2) Restart the system
</translate>
 
}}
3) Start your Java app to check the result.
 
4) If, for some reason, the entry in '''~/.profile''' or '''/etc/profile''' had no effect, you can put the following line into '''/etc/environment''':
 
_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"
 
<br clear="all"/>
 
=Links=
 
The source is this question at askubuntu.com:
 
How can I get a java apps to use the GTK+ theme? [http://askubuntu.com/questions/21886/how-can-i-get-a-java-apps-to-use-the-gtk-theme]
 
<br clear="all"/>
=Support=
 
Following is a link to this page's forum counterpart where you
can post any related feedback: [https://forum.manjaro.org/t/wiki-set-all-java-apps-to-use-gtk-font-theme-settings/19305]
 
<br clear="all"/>
[[Category:Contents Page]]


<hr>
{{SectionTemplate|
[[File:Chmsee-icon.png|left|36px]]
<translate><!--T:12--> See Also</translate>|
<translate>
<!--T:9-->
* [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)]}}
</translate>
[[Category:Contents Page{{#translation:}}]]

Latest revision as of 06:58, 24 January 2023

Other languages:
English • ‎español • ‎русский • ‎فارسی

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.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.