Absolute positioning (No layout manager) vs. absol

2019-05-23 06:25发布

Will the final application result be identical across different platforms and resolutions etc. when using absolute positioning in MiGlayout as the layout manager compared to using no layout manager (Setting layout manager to null)?

Is there a difference between the absolute positioning in MiGlayout solution vs. the no layout manager solution?

2条回答
▲ chillily
2楼-- · 2019-05-23 06:41

Think about this. Even if you supply a singe font for your application, it will be rendered differently on different OSs, it can even be rendered differently on the same OS under different DPI.

Layout managers are your protection against these problems, sure, when you first start using them, they seem to get in the way, but once you get use to them, you'll never want to do without (try coding in VB and tell me otherwise)

Layout managers let you focus on the complexities of flow control and usability, without having to worry how it might appear at a font 2pts larger then you are designing with, or on larger/smaller screen resolutions.

I've spent 2 years undoing the previous developers work who insisted on using Arial font and manually setting of component sizes because he believed he couldn't get his forms to layout properly. The feed back I have from users about the change has all been positive and we're now looking to implementing dynamic font resizing into the application. There is no way I'd try that without layout managers.

I'd say you have a better chance with MigLayout then you do without -IMHO

查看更多
欢心
3楼-- · 2019-05-23 06:45

Is there a difference between the absolute positioning in MiGlayout solution vs. the no layout manager solution?

yes and most important, JComponents layed by AbsoluteLayout aren't resizible with Container, have to add ComponentListener and to create bunch of code for continious resize, this is hardier job as learning how MigLayout works

查看更多
登录 后发表回答