final SpringLayout layout = new SpringLayout();
comp = new JPanel(layout);
comp.setBorder(BorderFactory.createEmptyBorder(6,6,6,6));
comp.setOpaque(true);
final Spring constant6 = Spring.constant(6);
final Spring constant0 = Spring.constant(0);
final Spring glue12 = Spring.constant(12,12,Short.MAX_VALUE);
final JLabel label = new JLabel("ID: ");
invalidLabel = new JLabel("Invalid URI");
invalidLabel.setForeground(new Color(225, 25, 25));
idText = new JTextField(19);
idText.getDocument().addDocumentListener(this);
idText.setMaximumSize(new Dimension(Short.MAX_VALUE, idText.getPreferredSize().height));
comp.add(label);
comp.add(idText);
comp.add(invalidLabel);
layout.putConstraint(SpringLayout.WEST, idText, constant6, SpringLayout.EAST, label);
layout.putConstraint(SpringLayout.WEST, invalidLabel, constant6, SpringLayout.EAST, idText);
Spring nextY = Spring.max(layout.getConstraint(SpringLayout.SOUTH, idText), layout.getConstraint(SpringLayout.SOUTH, label));
nextY = Spring.sum(nextY, constant6);
comboLabel = new JLabel();
comboBox = new JComboBox();
comboBox.addActionListener(this);
comboBox.setEditable(false);
comp.add(comboLabel);
comp.add(comboBox);
final SpringLayout.Constraints constraints = layout.getConstraints(comboLabel);
constraints.setHeight(Spring.max(constraints.getHeight(), layout.getConstraints(comboBox).getHeight()));
layout.putConstraint(SpringLayout.NORTH, comboBox, constant0, SpringLayout.NORTH, comboLabel);
layout.putConstraint(SpringLayout.NORTH, comboLabel, nextY, SpringLayout.NORTH, comp);
layout.putConstraint(SpringLayout.WEST, comboBox, constant6, SpringLayout.EAST, comboLabel);
nextY = layout.getConstraint(SpringLayout.SOUTH, comboBox);
nextY = Spring.max(nextY, layout.getConstraint(SpringLayout.SOUTH, comboLabel));
nextY = Spring.sum(nextY, constant6);
Spring right = layout.getConstraint(SpringLayout.EAST, comboBox);
final JLabel descriptionLabel = new JLabel("Description");
descriptionArea = new JTextArea(4, 35);
descriptionArea.setWrapStyleWord(true);
descriptionArea.setLineWrap(true);
descriptionArea.getDocument().addDocumentListener(this);
final JScrollPane scroll = new JScrollPane(descriptionArea);
comp.add(descriptionLabel);
comp.add(scroll);
layout.putConstraint(SpringLayout.NORTH, descriptionLabel, nextY, SpringLayout.NORTH, comp);
layout.putConstraint(SpringLayout.WEST, scroll, constant0, SpringLayout.WEST, idText);
final Spring idTextWidth = layout.getConstraints(idText).getWidth();
layout.getConstraints(scroll).setWidth(Spring.sum(idTextWidth, idTextWidth));
layout.putConstraint(SpringLayout.NORTH, scroll, constant6, SpringLayout.SOUTH, descriptionLabel);
right = Spring.max(right, layout.getConstraint(SpringLayout.EAST, scroll));
nextY = Spring.sum(layout.getConstraint(SpringLayout.SOUTH, scroll), glue12);