void () { final JPanel panel = new JPanel(new GridBagLayout()); final JButton button1 = new JButton(); button1.setPreferredSize(new Dimension(100,20)); final JButton button2 = new JButton(); button2.setPreferredSize(new Dimension(100,100)); GridBagConverter converter = new GridBagConverter(); converter.addComponent(button1, new GridConstraints(0,0,1,1,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0)); converter.addComponent(button2, new GridConstraints(1,0,1,1,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0)); applyConversionResults(panel, converter); final Dimension preferredSize = panel.getPreferredSize(); assertEquals(120, preferredSize.height); }