You can use a JPanel
with a titled Border from the BorderFactory
.
JPanel box = new JPanel();
box.add(new JLabel("Some element"));
box.setBorder(BorderFactory.createTitledBorder("Box Title"));
You can add any other components to the JPanel
and lay them out as you wish. The Border just frames them... Here is a more extensive tutorial which also explains different styles.