We have a panel which displays a form with an arbitrary number of JTextFields, JComboBoxes and JTextAreas (each with a corresponding JLabel).
The current code uses a GridBagLayout but I’d like to know if there is already a layout for this kind of task (playing with WrapLayout at the moment but aligning the fields seems tricky).
Is there any layouts particularly for this or am I best just sticking with the lovely GridBagLayout code we already have?
I would almost always recommend the JGoodies
FormLayoutas layout when you create a form. The documentation contains an example of a layout with a dynamic number of components (code snippet 6, which I copy-paste here to give you an idea)They have a demo available through Java web start