0

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? ;-)

mKorbel
  • 109,525
  • 20
  • 134
  • 319
PiBurner
  • 75
  • 11
  • 2
    Possible duplicate of [*What is the purpose of using Java Layout Mangers?*](http://stackoverflow.com/q/37800301/230513). – trashgod Nov 18 '16 at 10:02
  • You could use [UIManager](https://docs.oracle.com/javase/8/docs/api/javax/swing/UIManager.html) for this. `UIManager.getDefaults().keys()` will give you all the keys, then you could loop through it, get the value of the key `UIManager.get(key)` then check if the value is an instance of FontUIResource `if(value instanceof FontUIResource){//set the font here}` – Chains Nov 18 '16 at 15:46
  • Thanks, guys. So basically if using Netbeans, the project GUI has to be built on only one pc. If not using Netbeans, the layout manager (Free or group) will size things the same wherever the .jar is run when the app 'consults' the UIManager to set fonts and sizing when a control is instantiated. And that's the only way to get the same thing for any user on any pc when running the app. – PiBurner Nov 19 '16 at 16:22

1 Answers1

0

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.

PiBurner
  • 75
  • 11