Which Layout Manager do you use?

2019-03-18 02:12发布

What java GUI layout manager does everyone use? Lately, I have been using MigLayout, which has some powerful component controls. Just wanted to see what other developers are using other than the standard JDK ones.

22条回答
做自己的国王
2楼-- · 2019-03-18 02:58

I started off using various nested layouts, then moved over to GridBagLayout (which is pretty frustrating). Since then I tried FormLayout (but found it wasn't suited to anything but forms) and settled firmly on TableLayout, which overall I'm very happy with.

Since then I've discovered MiGLayout and although I haven't done much more than play with it, it seems very capable, quite similar to TableLayout and probably a little cleaner.

The big plus for me is that MiGLayout is set to become part of the JDK, so I intend to use it pretty much exclusively when it does.

The other thing to remember is that no matter which heavy-weight LayoutManager you settle on, there is always a place for some of the simpler layout managers such as GridLayout. I've seen some horrible things done with GridBagLayout that could have been done much more easily with a simpler layout manager.

查看更多
劳资没心,怎么记你
3楼-- · 2019-03-18 02:59

MiGLayout is the GUI layout manager which is widely used by Java Developers.

查看更多
Fickle 薄情
4楼-- · 2019-03-18 03:01

MiG and FormLayout (JGoodies) are both excellent for manual layout (And almost all layout eventually becomes manual). My biggest piece of advice is to design your views so that you can completely rip out the layout and re-implement it without impacting your application (good separation of view and controller is key here).

Definitely take a look at JGoodie's PresentationModel approach for implementing 'dumb' views. I use this technique with a GUI builder (I use GroupLayout with the Jigloo GUI builder plugin) for tossing off quick prototypes. After 3 or 4 iterations, that usually goes out the window and we do a re-implement using MiG or FormLayout.

EDIT: Since I wrote this, I have moved to using MiG for all of my layouts, and I no longer use a GUI builder - it's just way too easy to lay things out using MiG.

查看更多
forever°为你锁心
5楼-- · 2019-03-18 03:02

I use BorderLayout 90% of the time while nesting BoxLayout and SpringLayout

查看更多
登录 后发表回答