I want to use GridBagLayout to mangae my swing interface display 2 columns and rows: For example: First Name: txtField Last Name: txtField2 I know i can use gridX, and gridY to specify the cell location, However it would be easier to GridBagConstraints.REMAINDER and GridBagConstraints.RELATIVE when you have more rows and columns. I don't understand how to use it, Can anyone show me how? Mindy Thanks!

I looks to me like it would be simpler just to use a GridLayout(2,2) for what you want. GridBayLayout can seem quite compilcated at first, but it not too bad once you get used to it. I think you'd need something like this: myPanel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1; constraints.weighty = 1; constraints.gridx = 0; constraints.gridy = 0; myPanel.add(PanelOne, constraints); constraints.gridx = 0; constraints.gridy = 1; myPanel.add(PanelTwo, constraints); constraints.gridx = 1; constraints.gridy = 0; myPanel.add(PanelThree, constraints); constraints.gridx = 1; constraints.gridy = 1; myPanel.add(PanelFour, constraints);

Sorry if there are any errors in there, but I think it should basicly work!