views:

267

answers:

1

Running a Java Swing program on Ubuntu Linux, I'm getting an odd bug where the font height is too large for the actual font size, that is, every piece of text (in menus, buttons, text areas etc.) has excess blank space underneath the text itself.

This does not depend on which font I select. It also does not depend on the font size chosen - setting a larger size in an attempt to use up the extra space, just causes the excess space to scale with the font size.

It does depend on the operating system -- it works fine on Windows. It also depends on the look and feel chosen -- it works with the GTK look and feel (which is otherwise not as attractive as the Metal look and feel, so I would prefer not to use that as a workaround if I can avoid it).

I can't find any mention of this on Google. Any ideas how to fix it?

+3  A: 

Are you using SunJDK or OpenJDK? I think OpenJDK uses some other fonts and in general has problems with fonts and layouts. If you're using default install of eclipse, you're with gcj which is even more unpredictable. Try SunJDK.

tulskiy