Problem with GridBagLayout's gridheight constraint
Hi, I'm trying to figure out a problem in a large GUI via a small dummy GUI with the same issue. Here's the dummy's code:
publicstaticvoid main(String[] args){
JFrame frame =new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container window = frame.getContentPane();
window.setLayout(new GridBagLayout());
GridBagConstraints c =new GridBagConstraints();
c.anchor = GridBagConstraints.FIRST_LINE_START;
c.fill= GridBagConstraints.NONE;
JPanel one =new JPanel();
JPanel two =new JPanel();
JPanel dud =new JPanel();
one.setBackground(Color.RED);
two.setBackground(Color.BLUE);
c.gridx= 0;
c.gridy= 0;
//c.gridheight = 2;
window.add(one, c);
c.gridx= 1;
c.gridy= 1;
c.gridheight = 1;
window.add(two, c);
c.weightx = 1.0;
window.add(dud, c);
frame.pack();
frame.setVisible(true);
}
When this code is run, I get this:
http://www.freewebs.com/dragon_lagoon/picone.html
When I put the line that has been commented out back in, I expect/want to get this:
http://www.freewebs.com/dragon_lagoon/pictwo.html
What I actually get is this:
http://www.freewebs.com/dragon_lagoon/picthree.html
Does anyone know why this is happening or how to prevent it?

