The problem with Java Swing is the look and feels (Metal, Nimbus, GTK...), the worst out there compared to SWT, Windows, Mac and Gnome Tool Kit, and getting good looking widgets is utopist, yet I am asking the question though.
I need to know if there is a possibility to tweak a JButton to look like a default GTK button. Otherwise, can we give the JButton text a style (a shadow for example)?
public class myTweakedButton extends JButton {
// Override style attributes here.
}
Here is the style applied by GTK to the button widget:
style "button" {
xthickness = 3
ythickness = 3
bg[NORMAL] = shade (1.07, "#cdcdcd")
bg[PRELIGHT] = shade (1.09, "#cdcdcd")
bg[ACTIVE] = shade (1.0, "#cdcdcd")
bg[INSENSITIVE] = mix (0.25, @bg_color, "#e2e1e1")
fg[INSENSITIVE] = "#9c9c9c"
engine "murrine" {
#contrast = 1.0
border_shades = {1.04, 0.82}
reliefstyle = 5
shadow_shades = {1.02, 1.1}
textstyle = 1
glowstyle = 5
glow_shade = 1.1
#text_shade = 1.04
}
This is how a Button looks like when using the default GTK Look and Feel provided by Java engine:
And here how a button looks like under Linux (GTK 2.0).
The difference is actually a bad text hinting in Java GTK LAF, while GTK button text is styled with a discrete shadow.