MiDaa MiDaa - 1 year ago 200
Java Question

How to make equally divided cells in Intellij Java GUI designer GridlayoutManager

I am new to IntelliJ java GUI designer and I found the default GridlayoutManager really confusing.
Please check the picture attached.(This is my first question in SO, not enough reputation to insert image in post :{ )
GUI designer screenshot

I'd like to make area A and area B to be equal in width.

I've tried to adjust some of the properties such as "can grow" "want grow" "can shrink" but unfortunately none of them seems to change anything.

I tried adjust the green bars outside the panel but it does not allow me to do so...

Any tutorial on this designer or any idea on how to make them equally divided will be much appreciated.

PS: Sorry for the poor English, I'm not a native English speaker...

Answer Source

GridLayout comes with 3 different Constructors:

GridLayout() //the default one
GridLayout(int rows, int col) // defining no of rows and no of columns.
GridLayout(int rows, int col, int hgap, int vgap) // defining no of rows and columns with certain gap.

Third constructor takes care of the width of the column by adjusting itself according to the dimensions of the component placed in it. Reference: Grid Layout. According to your requirement, I would suggest you to go with BoxLayout. It will give equal size to both of your columns.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download