You are not logged in.

#1 2014-01-02 18:12:48

2mac
Member
Registered: 2013-11-09
Posts: 95

[SOLVED] Java GTK look and feel

I opened a thread recently about replacing the ugly swing buttons in Java applications. After successfully modifying my ~/.bashrc, all was well. However, these new changes were only present when run from a terminal. I assumed it was because my desktop was still running a bash session that hadn't loaded the new options yet, so I restarted.

Symptom: Java apps launched from the GUI still have old swing buttons, but have the GTK look and feel when launched from a terminal.

My .bashrc additions:

# Java stuff
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"

I use SLiM for a graphical login experience. Could this be affecting it? I'm not sure what happens differently behind the scenes when using a login manager other than that CTRL+ALT+F7 brings me to my GUI when I use one (because all 6 TTYs are still TTYs).

Last edited by 2mac (2014-01-02 20:51:35)

Offline

#2 2014-01-02 18:48:27

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [SOLVED] Java GTK look and feel

Just a guess: Try putting the "export" command in the middle of your "~/.xinitrc" file, which is used by SLiM when loading your X session.

Offline

#3 2014-01-02 19:14:39

2mac
Member
Registered: 2013-11-09
Posts: 95

Re: [SOLVED] Java GTK look and feel

I put

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

at the top of my ~/.xinitrc, and it had no effect. The "&" is necessary, correct? I was told that all commands before the "exec" line should end in an ampersand.

Last edited by 2mac (2014-01-02 19:15:34)

Offline

#4 2014-01-02 19:43:30

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [SOLVED] Java GTK look and feel

No, the ampersand is not necessary, because that command finishes instantly. Even so, it shouldn't make a difference.

I'm sorry, I'm not sure how to fix that Java issue. hmm

EDIT: The ampersand was apparently the problem! See below. smile

Last edited by drcouzelis (2014-01-02 21:10:26)

Offline

#5 2014-01-02 20:11:14

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Re: [SOLVED] Java GTK look and feel

I had a similar issue where .xinitrc wasn't working to set an environment variable. I put mine in ~/.config/openbox/environment and it worked. If you run openbox try that. If using a different window manager maybe try /etc/environment I am unsure of how slim functions though maybe there are config files for it. I think slim is on it's way out though (already lacks some compatibility with systemd; they may fix it though upstream I have no idea). But yeah try the environment file way and see if that does it (assuming you have tested your command from the shell and it works how you want).

Offline

#6 2014-01-02 20:33:47

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [SOLVED] Java GTK look and feel

Try it from .xinitrc without the ampersand. By appending &, you export the variable only in a background process/subshell, so it does make a difference (I checked this in both bash and zsh).

Also remove the export from .bashrc, so you can easily test whether the export from xinitrc is successful by echoing the variables in a terminal emulator running in your X session.

Offline

#7 2014-01-02 20:51:21

2mac
Member
Registered: 2013-11-09
Posts: 95

Re: [SOLVED] Java GTK look and feel

Removing the ampersand did successfully resolve the issue.

Thanks for your help.

Offline

#8 2014-01-02 23:30:02

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: [SOLVED] Java GTK look and feel

FWIW (and I am open to being corrected if this is wrong) I put those commands in /etc/profile. I did that because I wanted all system users to have this functionality.


Matt

"It is very difficult to educate the educated."

Offline

#9 2014-02-13 07:28:51

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [SOLVED] Java GTK look and feel

Can you show me an example of how Java apps look like on your machines?

I added the settings discussed here but still Crashplan backup software, which is a Java applications, does not respect my icon theme. Yet I am not sure whether the icons used there are the Swing icons discussed here.

Icons: http://i.imgur.com/BIG1pAb.png

Offline

#10 2014-02-13 21:11:19

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: [SOLVED] Java GTK look and feel


Matt

"It is very difficult to educate the educated."

Offline

#11 2014-02-14 11:39:07

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [SOLVED] Java GTK look and feel

@mrunion

Is NetBeans using the same iconset as other GTK applications?

Offline

#12 2014-02-14 16:21:31

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: [SOLVED] Java GTK look and feel

Hmmm. I'll have to check. Are you sure that the app isn't defining it's own icons? I mean, when I write Java apps I usually define my own icon for things -- the user doesn't have the option to modify them without taking apart the code.

I will try to do more digging this evening. Is the app you're using the same as I would get by installed CrashPlan from the AUR? If so, I may try installing it and see if my icons are different from yours.


Matt

"It is very difficult to educate the educated."

Offline

#13 2014-02-14 16:26:30

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [SOLVED] Java GTK look and feel

@mrunion

That makes sense. I did not know that the programmer can define custom icons in his Java application.

But thanks for checking Crashplan. Indeed installing the package from AUR will give you exactly the same version.

Cheers!

Offline

#14 2014-02-15 23:02:12

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: [SOLVED] Java GTK look and feel

I had time for a quick glance it it does appear that it uses its own icon resources.


Matt

"It is very difficult to educate the educated."

Offline

#15 2014-02-16 07:33:41

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [SOLVED] Java GTK look and feel

@mrunion

Thanks for finding out!

Offline

Board footer

Powered by FluxBB