JComponent () { final JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8)); myTitleLabel = new JLabel(); panel.add(myTitleLabel); panel.add(Box.createVerticalStrut(8)); panel.add(myNameSuggestionsField.getComponent()); return panel; }