Re-using Ids


While trying to remove and then rebuild some Elements I went trought this warning :

Possible conflicting id [inhabitant_name] detected. Consider making all Ids unique or use #id in control-definitions.

Could someone please guide me on this issue?

This is what I do to remove the existing Element (which is contained in inhabitant_stats) :


List<Element> elements = nifty.getCurrentScreen().findElementByName(“inhabitant_stats”).getElements();

Iterator i = elements.iterator();

while (i.hasNext()){

Element element = (Element);





And here is my Element definition / rendering :


PanelBuilder line = new PanelBuilder();



line.height(“40px”);“inhabitant_name”);, nifty.getCurrentScreen(), nifty.getCurrentScreen().findElementByName(“inhabitant_stats”));


Those two steps are called in this order after I click on a button.

I even tried to set the ID at null in the removal step but doesn’t work either.

If any of you got a clue.

Have a nice day.