JComponent () { for (JComponent component : myComponents) { component.setForeground(myForegroundColor); component.setBackground(myBackgroundColor); component.setFont(myFont); } myResult.setForeground(myForegroundColor); myResult.setBackground(myBackgroundColor); myResult.setFont(myFont); GridBagConstraints constraints = new GridBagConstraints(); constraints.weighty = 1; constraints.fill = GridBagConstraints.VERTICAL; myResult.add(Box.createVerticalStrut(1), constraints); return myResult; }