Phil Longenecker Phil Longenecker - 9 days ago 5
Java Question

changing default font sizes for Swing controls in Netbeans

I have Netbeans 8.1 on two computers. Same JDK. When building a form/pane/panel, the default sizes for fonts on Swing controls like labels are different. Properties on one has Tahoma 11 plain and the other has Tahoma 13 plain. Also, the Menu Bar is a different size. If I use both pc to build an app, the sizing at launch causes scrollbars to appear if written on one or the other. Label sizes and text within also changes.

Is there a way to set what Netbeans uses for font and control sizes, so I can have both work the same? I'm not talking about the font size in the editor text area, which is done by setting Tools, Options, Fonts & Colors.

Would this have anything to do with the different video chipset in the pc's?

Has anyone seen this problem before?

What would be the result if there was a team building the app on different pc's?

Or should I just quit using the offending pc?

Did I ask enough questions? ;-)

Answer

I figured out why I'm getting the different sizing. I have a large, widescreen monitor on one of the Win7 computers, and a long time ago I had set the DPI to 120 (125%). This causes Netbeans and Java to run at the different sizes. Setting DPI back to 96 solves the problem. Most notably, anything developed at 96 DPI (on another Win7 pc) will run on this pc at 120 DPI with the edges shortened. End result is the Swing controls at the right and bottom edges are covered by the scrollbars of the application.

I can use the ctrl-scrollwheel trick to enlarge some of the text and icons while using 96DPI, but for someone needing everything shown to be larger, this is just a work-around. At least Netbeans allows a setting for the editor text.

It would be nice if Netbeans and Java would let me set the preferred DPI to develop in and run as. As for my Linux pc, that would be the only answer I can come up with.

Thanks all.