Nifty ListBox – Autoscroll

Is it possible to have a autoscrolling listbox? I tried the selectItemByIndex(int index) method but that does not work.



And second thing, is it possible to have the text of the items be wrapped? Are multiline items allowed anyway?

Wrapping in ListBox is not supported yet, but there is a ticket about it on the nifty-gui site.

What do you mean by auto scrolling?

That it automatically scrolls to the bottom/top when you add an item or that it scrolls to show a specific item?

If it’s the latter, then you have the two methods showItem(Item item) and showItem(int index) that should do that.

I want the listbox to scroll down when a new item is added.

Ok I got it, the showItem() method was a good hint:



listBox.showItemByIndex(listBox.getItems().size() - 1);