So far I've only been able to add an additional five text fields to the bottom of the panel, but I need everything to go in-between. I thought about using a List to store all the different componentsa, nd then just redraw the whole window when the list is updated. Is there a better way?
Paul Clapham wrote:Well, in my opinion the best way to do that is to add the new fields when you initialize your GUI, but make them not visible. Then when the user asks to "add" them, you simply make them visible.
Others may have other ideas.
I tried your idea and used setVisible(false), but that doesn't really solve my problem because there's just an extra line of blank space. The components are actually there, just not visible and I can't predict how many fields the user will actually need. I've come up with a better solution though, but it will require me to redesign the GUI.
I did try that as well, but it just seemed to add extra components instead of inserting them between two existing ones. Perhaps I'm wrong, but the best solution that I see is to use a List and redraw as needed.