lemur listbox
Container menu = new Container();
guiNode.attachChild(menu);
menu.setLocalTranslation(getContext().getSettings().getWidth() / 2, getContext().getSettings().getHeight() / 2, 10);
ListBox listBox = new ListBox();
listBox.getModel().add(new ListBoxItem("Forest"));
listBox.addClickCommands(new Command() {
@Override
public void execute(Object source) {
ListBox list = (ListBox) source;
ListBoxItem boxItem = (ListBoxItem) list.getSelectedItem();
boxItem.action();
}
});
listBox.setVisibleItems(6);
listBox.setPreferredSize(new Vector3f(200, 200, 0));
listBox.setLocalTranslation((800) , 680, 0);
menu.addChild(listBox);
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package gui;
/**
*
* @author User
*/
public class ListBoxItem {
public String text;
public ListBoxItem(String text){
this.text = text;
}
public String toString(){
return text;
}
public void action(){
System.out.println("Click " + text);
}
}
Комментарии
Отправить комментарий