Changing width of GridLayout
grid-layout, java, layout, swing
Solution
You can use separate grid layout for each column.
GridLayout grid = new GridLayout(1,2);
GridLayout grid1 = new GridLayout(5,1);
GridLayout grid2 = new GridLayout(5,1);
grid.add(grid1);
grid.add(grid2);
You can now set widths of grid1 one and grid2.
Problem
I use the GridLayout for my JPanel and was wondering, if it's possible to change the width of the columns: ``` GridLayout grid = new GridLayout(5,2); panel.setLayout(grid); ``` Is there a simple way?