void () { final JPanel panel = new JPanel(new GridLayoutManager(2,2, new Insets(0,0,0,0), 11, 0)); final JTextField field1 = new JTextField(); setDefaults(field1); field1.setPreferredSize(new Dimension(15,20)); final JTextField field2 = new JTextField(); setDefaults(field2); field2.setPreferredSize(new Dimension(15,20)); final JTextField field3 = new JTextField(); setDefaults(field3); field3.setPreferredSize(new Dimension(100,20)); panel.add(field1, new GridConstraints(0,0,1,1,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0)); panel.add(field2, new GridConstraints(0,1,1,1,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0)); panel.add(field3, new GridConstraints(1,0,1,2,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0)); panel.doLayout(); assertEquals(100, panel.getPreferredSize().width); }