[Nifty] Adding dropdown-entries in java (in the controldefinitionbuilder)

Hey,

i’m trying to add the dropdown-entries for a dropdown inside a listbox-entry. (like the dropdowns available in most RTS to choose a faction for example). Googling only comes up with doing that after the screen has been build, but that’s not what i want.



[java]control(new DropDownBuilder(“tankDropDown”) {



{

width(“25%”);

}

});[/java]



This is how it currently looks, i want to add the entries at this point so i don’t have to add them everytime i use this controldefiniton.

Thanks for your help in advance!

[java]DropDownBuilder b = new DropDownBuilder("tankDropDown") {



{

width("25%");

}

};

Element e = b.build(nifty, screen, parentElement);

DropDown<String> dropDown = e.getNiftyControl(DropDown.class);

dropDown.addItem(myString);

[/java]

Exchange String for another type if your drop down should hold another type.