15.11.2014, 13:05
@DrumYum: The .build() method returns the Dialog instance.
For example:
The same can be done to all other dialog types. With this, you can loop through a collection of items and add them to the dialog.
For example:
PHP код:
InputDialog loginDialog = InputDialog.create(player, rootEventManager)
.caption("Login for Player " + player.getName())
.message("Please enter the password for account " + player.getName())
.buttonCancel("Disconnect")
.buttonOk("Login")
.onClickOk((inputDialog, s) -> player.sendMessage(Color.ORANGE, "You entered the password " + s))
.onClickCancel(abstractDialog -> player.kick())
.build();
loginDialog.setCaption("New caption");
loginDialog.show();
PHP код:
ListDialog myListDialog = ListDialog.(...).build();
for(int i = 0; i < 20; i++) {
myListDialog.addItem("Item nr." + i);
}
myListDialog.show();