本文整理汇总了Java中de.lessvoid.nifty.controls.listbox.builder.ListBoxBuilder类的典型用法代码示例。如果您正苦于以下问题:Java ListBoxBuilder类的具体用法?Java ListBoxBuilder怎么用?Java ListBoxBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListBoxBuilder类属于de.lessvoid.nifty.controls.listbox.builder包,在下文中一共展示了ListBoxBuilder类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bind
import de.lessvoid.nifty.controls.listbox.builder.ListBoxBuilder; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
this.nifty = nifty;
final ScreenController This = this;
Screen dialog = new ScreenBuilder(SCREEN_ID) {
{
controller(This);
layer(new LayerBuilder("foreground") {
{
childLayoutCenter();
control(new ListBoxBuilder("moleculeList") {
{
childLayoutVertical();
set("horizontal", "false");
displayItems(10);
selectionModeSingle();
optionalVerticalScrollbar();
optionalHorizontalScrollbar();
width("85%");
height("85%");
x("8%");
y("10%");
}
});
}
});
}
}.build(nifty);
//Element e = dialog.findElementByName("foreground");
/*CreateListBoxControl clistBox = new CreateListBoxControl("listBoxDynamic");
clistBox.set("horizontal", "false");
clistBox.setWidth("85%");
clistBox.setHeight("85%");
//clistBox.setY("10%");
//clistBox.setX("8%");
clistBox.setChildLayout("vertical");
clistBox.set("displayItems", "10");
clistBox.set("vertical", "optional");
clistBox.set("horizontal", "optional");
listBox = clistBox.create(nifty, dialog, e);
File dir = Constants.getMoleculeLocation();
File[] fs = dir.listFiles();
if (fs == null) {
fs = new File[0];
}
for (File f : fs) {
String name = FileTools.getFileName(f);
listBox.addItem(name);
}*/
ListBox box = dialog.findNiftyControl("moleculeList", ListBox.class);
// add items; box.addItem
File dir = Constants.getMoleculeLocation();
String[] fs = FileTools.listSubFiles(dir);
for (String subF : fs) {
box.addItem(subF);
}
nifty.addScreen(SCREEN_ID, dialog);
nifty.gotoScreen(SCREEN_ID);
}
示例2: GListBox
import de.lessvoid.nifty.controls.listbox.builder.ListBoxBuilder; //导入依赖的package包/类
public GListBox(String id){
super(id);
builder = new ListBoxBuilder(id);
name="listBox";
}