Is there an equivalent in Java for fieldset (HTML)?

RedhopIT picture RedhopIT · May 30, 2012 · Viewed 12.5k times · Source

Is there an element in Java (i.e. Swing/AWT or SWT) that is equivalent to the HTML element fieldset?

Answer

Pier-Alexandre Bouchard picture Pier-Alexandre Bouchard · May 30, 2012

Create a Panel, create a titled border and you will be able to put inside all your field components.

JPanel panel = new JPanel();
panel.add(new JLabel("foo"));
panel.setBorder(BorderFactory.createTitledBorder("bar"));