Hi! I'm having some problems with gridbaglayout trying to get functionality that maybe isn't even there.
The problem is the following
I have 3 Jpanels with differend contents. I want panel 1 to be displayed to the left of the screen filling the y-axis, panel 2 in the middle filling y and panel 3 to the right.
I Want panel 1 to take 1/10 of space in x-direction, panel 2 8/10 and panel 3 1/10 to. So i made these three constraints.
GridBagConstraints c1 = new GridBagConstraints();
c1.fill = c1.BOTH;
c1.gridx = 0;
c1.gridy = 0;
c1.weightx = 1;
c1.weighty = 1;
c1.gridwidth = 1;
this.add( panel1, c1 );
GridBagConstraints c2 = new GridBagConstraints();
c2.fill = c2.BOTH;
c2.gridx = 1;
c2.gridy = 0;
c2.weightx = 1;
c2.weighty = 1;
c2.gridwidth = 8;
this.add( panel2, c2 );
GridBagConstraints c3 = new GridBagConstraints();
c3.fill = c3.BOTH;
c3.gridx = 10;
c3.gridy = 0;
c3.weightx = 1;
c3.weighty = 1;
c3.gridwidth = 1;
this.add(panel3, c3 );
Now the problem is that the panels doesn't take up the space i want. Panel1 gets way to big, and then shrink when panel2 is filled with content.
So the question is if there is a way to make gridbaglayout force all grids to be of equal size like gridlayout or should I use another layoutManager. In that case, Which one?