void () { final JPanel panel = new JPanel(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), 7, 0)); final JTextField field1 = new JTextField(); setDefaults(field1); field1.setPreferredSize(new Dimension(100, 40)); final JTextField field2 = new JTextField(); setDefaults(field2); field2.setPreferredSize(new Dimension(100, 40)); panel.add(field1, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0)); panel.add(field2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0)); panel.doLayout(); final Dimension preferredSize = panel.getPreferredSize(); assertEquals(207, preferredSize.width); panel.setSize(panel.getPreferredSize()); panel.doLayout(); assertEquals(new Rectangle(0, 0, 100, 40), field1.getBounds()); assertEquals(new Rectangle(107, 0, 100, 40), field2.getBounds()); }