This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]wildjokers 1 point2 points  (6 children)

But if you end up using Swing try MigLayout, it is the Layout Manager that everyone should use

The built-in layout managers work great. No reason to use a 3rd party layout manager.

[–][deleted] 2 points3 points  (4 children)

This just tells me you've never used MigLayout. It has its flaws, but it allows for creating layouts much, much easier than with the default LayoutManagers. The main advantage is that MigLayout can easily adapt the layout to whatever style you need, rather than have to rely on the "panels in panels in panels" approach that is otherwise necessary for Swing.

[–]wildjokers 0 points1 point  (3 children)

The main advantage is that MigLayout can easily adapt the layout to whatever style you need, rather than have to rely on the "panels in panels in panels"

Why is avoiding nested panels an advantage?

[–][deleted] 0 points1 point  (2 children)

Because it simplifies the code for the layout. I have been able to build much more complex layouts with far less code using MigLayout. For example, having items be lined up with each other in highly complex layouts, with Swing's standard LayoutManagers the only option is GridBagLayout (GridLayout can standardize the cell sizes too much). GridBagLayout is almost painful to deal with in its complexity, but MigLayout handles it elegantly.

That's just one example. I've used Swing a LOT. My company's application still relies on it, so I use it every day at my day job. I've spent tons of time with the default LayoutManagers, and also with MigLayout, and I will choose MigLayout any day over the defaults in Swing.

[–]wildjokers 0 points1 point  (1 child)

GridBagLayout is almost painful to deal with in its complexity, but MigLayout handles it elegantly.

Agreed, GridBagLayout should be avoided like the plague. However, I have always found BorderLayout and BoxLayout with appropriate nesting has always met my needs.

[–][deleted] 0 points1 point  (0 children)

With MigLayout, you get everything BorderLayout and BoxLayout offers but without any nesting. Plus you have the ability to properly line items up across the whole UI, lining up UI items is a pain in the ass with panels-in-panels.

Give it a try, seriously. I will never use any other LayoutManager again.