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


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”) {





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") {





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

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



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