miglayout
miglayout copied to clipboard
Spacing in 5.0 for swing much greater
I recently upgraded one of my applications to MigLayout 5.0 and the users complain that the fields didn't fit on the screen anymore. Attached are screenshots of the same screen under 3.7.3, 4.2 and 5.0 and it is clearly visible under 5.0 the spacing is almost double.
I think the gaps are larger since this commit 3dcc68737bec6dfe188a4bad8db372be280283c4
You can restore the old gaps in your app:
PlatformDefaults.setRelatedGap(LPX4, LPY4);
PlatformDefaults.setUnrelatedGap(LPX7, LPY9);
PlatformDefaults.setParagraphGap(LPX14, LPY14);
PlatformDefaults.setIndentGap(LPX9, LPY9);
PlatformDefaults.setGridCellGap(LPX4, LPY4);
That commit indeed has a big space increase.
Hello, I think I am experiencing a similar problem. I am using MigLayout and it is frequently creating too much space between components. When I copied in the 5 lines you have above @JFormDesigner Java told me it couldn't find any of the symbols, including PlatformDefaults.
With MigLayout 11.0 I fixed the Problem for Windows Swing with
PlatformDefaults.setRelatedGap( new UnitValue(4, UnitValue.LPX, null), new UnitValue(4, UnitValue.LPY, null)); PlatformDefaults.setUnrelatedGap( new UnitValue(7, UnitValue.LPX, null), new UnitValue(9, UnitValue.LPY, null)); PlatformDefaults.setParagraphGap( new UnitValue(14, UnitValue.LPX, null), new UnitValue(14, UnitValue.LPY, null)); PlatformDefaults.setIndentGap( new UnitValue(9, UnitValue.LPX, null), new UnitValue(9, UnitValue.LPY, null)); PlatformDefaults.setGridCellGap( new UnitValue(4, UnitValue.LPX, null), new UnitValue(4, UnitValue.LPY, null));
in a static block.