void (final FormSourceCodeGenerator generator, final GridBagConstraints constraints, final String variable, final String parentVariable) { if (!myHaveGbc) { generator.append("java.awt.GridBagConstraints gbc;\n"); myHaveGbc = true; } generator.append("gbc = new java.awt.GridBagConstraints();\n"); GridBagConstraints defaults = new GridBagConstraints(); if (defaults.gridx != constraints.gridx) { setIntField(generator, "gridx", constraints.gridx); } if (defaults.gridy != constraints.gridy) { setIntField(generator, "gridy", constraints.gridy); } if (defaults.gridwidth != constraints.gridwidth) { setIntField(generator, "gridwidth", constraints.gridwidth); } if (defaults.gridheight != constraints.gridheight) { setIntField(generator, "gridheight", constraints.gridheight); } if (defaults.weightx != constraints.weightx) { setDoubleField(generator, "weightx", constraints.weightx); } if (defaults.weighty != constraints.weighty) { setDoubleField(generator, "weighty", constraints.weighty); } if (defaults.anchor != constraints.anchor) { setIntField(generator, "anchor", constraints.anchor, myAnchorMap); } if (defaults.fill != constraints.fill) { setIntField(generator, "fill", constraints.fill, myFillMap); } if (defaults.ipadx != constraints.ipadx) { setIntField(generator, "ipadx", constraints.ipadx); } if (defaults.ipady != constraints.ipady) { setIntField(generator, "ipady", constraints.ipady); } if (!defaults.insets.equals(constraints.insets)) { generator.append("gbc.insets="); generator.newInsets(constraints.insets); } generator.startMethodCall(parentVariable, "add"); generator.pushVar(variable); generator.pushVar("gbc"); generator.endMethod(); }