2

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?

Birdman
  • 5,244
  • 11
  • 44
  • 65
  • 3
    **don't** use absolute positioning ever :-) Even the most intelligent LayoutManager cannot protect you if you do it ... – kleopatra Aug 31 '12 at 10:14
  • I see the problem, but NO layout manager gives the same possibility of precision when placing components.. What to do?! – Birdman Aug 31 '12 at 10:25
  • @Alex by AbsoluteLayout you have to place each of JComponents separatelly, (and I hope that by using Insets), – mKorbel Aug 31 '12 at 10:33

2 Answers2

5

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

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
  • 3
    I hope that previous developer is now your dedicated "bring-me-a-fresh-cup-of-coffee" slave – Robin Aug 31 '12 at 12:33
  • @Robin actually, he's working as J2EE developer 8P - yes, his name is mud around the office – MadProgrammer Aug 31 '12 at 17:50
  • *"he believed he couldn't"* Belief that you cannot attain something is a good prerequisite for *not* attaining it. Perhaps this developer is better suited to web development - with tables nested within tables for layout of visual elements. ;) – Andrew Thompson Sep 01 '12 at 03:06
4

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

om-nom-nom
  • 62,329
  • 13
  • 183
  • 228
mKorbel
  • 109,525
  • 20
  • 134
  • 319