Question

In my form there is a JComboBox, and depending on what is selected I would like to add some additional rows (labels and JTextFields) to the form just below the JComboBox and push the rest of the fields that many rows lower. Is this possible with JGoodies DefaultFormBuilder (or any other technique), and if so how?

Était-ce utile?

La solution

As far as I can tell there is no proper way. So what I ended up doing was creating a JPanel for each field with a BoderLayout. Then I added the max number of fields I would ever need to the form. Then when I needed to move fields down, I would remove them from the allocated JPanel's and push them to the ones below in a loop.

Not exactly the prettiest or most elegant but I couldn't find another solution at all...

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top