void () { final JPanel panel = new JPanel(new GridBagLayout()); final JTextField field1 = new JTextField(); field1.setPreferredSize(new Dimension(100,20)); final JTextField field2 = new JTextField(); field2.setPreferredSize(new Dimension(100,20)); GridBagConverter converter = new GridBagConverter(new Insets(0, 0, 0, 0), 10, 0, false, false); converter.addComponent(field1, new GridConstraints(0,0,1,1,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0)); converter.addComponent(field2, new GridConstraints(0,1,1,1,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0)); applyConversionResults(panel, converter); final Dimension preferredSize = panel.getPreferredSize(); assertEquals(210, preferredSize.width); }