I'm wondering about the "best" way to achieve a relatively usual layout with mig layout. I have large components (say, JLists in this case), and buttons between the two large components. So I want a vertical button stack, with a gap at the bottom. I have done it a couple of time, but
So, I want to achieve this presentation with miglayout :
+---------------+ +----+ +----------------------+
| list 1 | | bt1| | list2 |
| | +----+ | |
| | +----+ | |
| | | bt2| | |
| | +----+ | |
| | +----+ | |
| | | bt3| | |
| | +----+ | |
| | | |
| | | |
+---------------+ +----------------------+
Currently, I do :
add(new JScrollPane(jlist1),"grow, pushy");
add(button1,"flowy, aligny top, split 3");
add(button2, "");
add(button3, "");
add(new JScrollPane(jlist2), "grow, pushy");
Are there better ways to do it? Is it worthwhile to avoid creating a panel for putting the buttons in it?
I would just put the buttons in their own panel. That simplifies the layout and similar components tend to get modified together so it is good to have them in their separate function or class.
Whenever possible I try to use a tree-like structure of containers rather than have a complicated layout that includes all the components. It makes it harder to read and rearrange things when everything depends on the layout of everything else.