Johan Henriksson wrote:
Hello!
I've become tempted at some openjdk hacking. the JButton has pissed me
off for a long time. it doesn't work very well when shrunk:
* The text is replaced by ... even when ... takes almost more or as much
space
* instead of removing slack space at the sides of the text, it starts to
throw away the label
work-arounds in GUIs that has to be compact are really awful. I wouldn't
mind trying to fix this myself if someone gives me a few pointers (I'm
totally confused about AWT, java2d, any sort of acceleration and gtk(?))
but first:
1. would changing the behaviour break anything? (or enough to stop the
change?)
2. what's your opinion? would a patch be accepted?
/Johan
Hi Johan,
You can control the button margins within the look and feel (LAF), at
least for LAFs derived from BasicLookAndFeel (I never studied the Synth
look and feel so I don't know if the same applies for LAFs based on
Synth). The property key is "Button.margin" and the default value is
InsetsUIResource(2, 14, 2, 14). Maybe you just want to reduce the left
and right margins for your app...or customise the ButtonUI class to
adjust the margins dynamically according to the available space.
Regards,
Dave Gilbert
http://www.jfree.org/