JPanel (Iterable<? extends JComponent> components) { JPanel iconsPanel = new NonOpaquePanel(new GridBagLayout()); GridBag gb = new GridBag().setDefaultFill(GridBagConstraints.BOTH); for (JComponent component : components) { iconsPanel.add(component, gb.next()); } return iconsPanel; }