質問

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?

役に立ちましたか?

解決

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...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top