Hi there,
I know there are a bunch of threads around about Swing font handling, but none of them seem to solve my issue. I'm running Netbeans 6.0 (though the same problem occurs with NB 5.5) on a Linux box and I'm using the Swing Metal L&F (aka Java cross-platform L&F). Everything's fine, except the text font on the Swing components is too small (the editor font in NB is configurable in the Options dialog, but the GUI font isn't). This likely occurs because my display has a physical resolution of about 100-105 dpi (Xorg's dpi is set to 120), but the font rendering engine of Java2D apparently defaults to 72 dpi.
So what I need is basically a way to either change the dpi setting in Java2D/AWT/wherever, or change the font size that the Metal L&F uses on the widgets. There are lots of ways to do this programmatically from inside the application that needs to be affected. Obviously, since I don't want to recompile Netbeans from source, I need a way to change this stuff externally, without modification to the source. So far, I've been quite unsuccessful here.
Change the DPI setting in Java2D - apparently no chance. All the FAQs I read so far say that J2D defaults to 72 dpi and as a "remedy" for too small fonts they suggest using larger fonts. Brilliant idea, thank you...
Change the font (incl. font size) of Swing's Metal L&F - this looks a bit more promising. The DefaultMetalTheme class seems to be respecting the system properties "swing.plaf.metal.controlFont", "swing.plaf.metal.userFont" and "swing.plaf.metal.systemFont". These can be set to the font name and size (as accepted by the Font.decode() method) that are to be used in the Swing GUI. I tried starting the popular SwingSet2 demo with these properties set to larger fonts and all seems to be working correctly:
$ java -Dswing.plaf.metal.controlFont=Freesans-16 -jar /path/to/SwingSet2.jar
However, starting Netbeans with these properties set (via the -J-D command line option) does not change anything. Everything looks just as before, without setting them. And that's where my current problem is...
Does anyone have further ideas on what can be done? I'm quite desperate already...
And yes, using the GTK L&F works OK and makes Netbeans look completely like a native GTK applications, but for various reasons this is
not what I want. I'd like to have the Metal look (I find it cooler than GTK anyway).
Thanks for any suggestions!
Mike