I have a listbox with items and I want to have an action done, when i click on a listbox item. But I don’t know how to do that.
codes:
xml:
java:
public void setFriendsList() {
friendslistbox.insertItem(“Friend1”, 0);
friendslistbox.insertItem(“Friend2”, 1);
friendslistbox.insertItem(“Friend3”, 2);
friendslistbox.insertItem(“Friend4”, 3);
friendslistbox.insertItem(“Friend5”, 4);
friendslistbox.insertItem(“Friend6”, 5);
}
Can someone help me? Thanks
http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Standard_Controls_ListBox
EventBus Notification
The ListBox supports EventBus notification for any action that changes the selection of the ListBox. In that case an instance of ListBoxSelectionChangedEvent is published using the id of the ListBox as the Topic for the Event.
ListBoxSelectionChangedEvent
EventBus notifications are explained here:
http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Nifty_Standard_Controls_%28Nifty_1.3%29#Standard_Controls_EventBus_Notifications