I want to have a vertical FlowLayout
to host my JPanels
. A lot of ppl suggest using BoxLayout
. However, I realize its behavior is not exactly same as FlowLayout
FlowLayout
BoxLayout with Y axis
As you can see, in FlowLayout
, when I stretch parent panel's width, its child panels' width remains the same.
However, in BoxLayout
, when I stretch parent panel's height, its child panels' height changed!. This seems to have similar behavior as 1 column 2 rows GridLayout
. This is not what I want.
Is there any way to prevent this?
I try to have vertical filler on the top and bottom of parent panel.
new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
But it doesn't help much. My 2 child panels' height still stretch along when I change parent's height.