Reputation: 1884
In my App, I want users to be able to continuously add Songs to a List in FormA. FormB will then show the added Songs as Labels.
I know how to create the Label-List, but unfortunately, the added Songs won't show up in FormB. I need a way to update FormB every time a Song is added, so FormB is always up-to-date.
This is what I've tried:
public void createPlaylist() {
for (int i = 0; i < songList.getSongList().size(); i++) {
Button temp = new Button(songList.getSongList().get(i).toString());
listCont.add(temp); //add Buttons to the List-Container for every Song in the List
}
centerCont.removeComponent(listCont);
centerCont.removeComponent(bottomCont); //remove Containers to add the updated ones (?)
centerCont.add(listCont).add(bottomCont); //add updated Containers
}
This doesn't work, since the FormB which should show the new added Buttons isn't doing it.
How do I achieve this?
Upvotes: 2
Views: 113
Reputation: 1884
Thanks to Diamond Mubaarak, I managed to solve the problem. I just pass the Forms to each other, so I call FormA.revalidate();
in the FormB Method.
Upvotes: 2