void () { final JPanel panel = new JPanel(new GridBagLayout()); final JTextField field1 = new JTextField(); field1.setMinimumSize(new Dimension(20, 5)); field1.setPreferredSize(new Dimension(20, 10)); final JTextField field2 = new JTextField(); field2.setMinimumSize(new Dimension(20, 25)); field2.setPreferredSize(new Dimension(20, 50)); final JTextField field3 = new JTextField(); field3.setMinimumSize(new Dimension(20, 70)); field3.setPreferredSize(new Dimension(20, 100)); GridBagConverter converter = new GridBagConverter(new Insets(0, 0, 0, 0), 0, 7, false, true); converter.addComponent(field1, new GridConstraints(0,0,1,1,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_WANT_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK, null, null, null, 0)); converter.addComponent(field2, new GridConstraints(1,0,1,1,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_WANT_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK, null, null, null, 0)); converter.addComponent(field3, new GridConstraints(2,0,1,1,GridConstraints.ANCHOR_CENTER,GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_WANT_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK, null, null, null, 0)); applyConversionResults(panel, converter); final Dimension minimumSize = panel.getMinimumSize(); assertEquals(70 + 7 + 70 + 7 + 70, minimumSize.height); final Dimension preferredSize = panel.getPreferredSize(); assertEquals(100 + 7 + 100 + 7 + 100, preferredSize.height); panel.setSize(panel.getPreferredSize()); panel.doLayout(); assertEquals(100, field1.getHeight()); assertEquals(100, field2.getHeight()); assertEquals(100, field3.getHeight()); }