Carey Brown wrote:** Remove component from panel BEFORE removing it from the list.
[Edit] I still agree that using a JTable enclosed in a JScrollPanel is the way to go.
Campbell Ritchie wrote:You are lucky to get that code to compile at all. You can add a panel to a display but not a List<JPanel>, and you cannot cast a List to a panel.
Where did you initialise those Lists? Are you declaring those Lists as fields; it may be possible for them to be local variables and reduce the size of your object.
Fred Kleinschmidt wrote:Well, yes. As it stands, in your action listener, you remove "label1" and "field1". The next time you click the button, you try to remove the same items that you have already removed. Those variables do not magically get reassigned to other items.
By using lists it will solve my issue?