本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.SelectBox.setSelected方法的典型用法代码示例。如果您正苦于以下问题:Java SelectBox.setSelected方法的具体用法?Java SelectBox.setSelected怎么用?Java SelectBox.setSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.SelectBox
的用法示例。
在下文中一共展示了SelectBox.setSelected方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getActor
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
@Override
public Actor getActor(VisualSettingManager visualSettingManager) {
final SelectBox<String> selectBox = new SelectBox<String>(visualSettingManager.getSkin());
selectBox.setItems(options);
selectBox.setSelected(selected);
selectBox.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
if (!(event instanceof SettingsMenu.SaveEvent))
return false;
set(selectBox.getSelected());
return true;
}
});
return selectBox;
}
示例2: addSelectBox
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
public <E> void addSelectBox(String label, E selected, E[] values, Consumer<E> lis) {
LabelStyle style = skin.get(LabelStyle.class);
Label l = new Label(label, style);
table.add(l).minHeight(l.getMinHeight()).prefHeight(l.getPrefHeight());
SelectBox<E> sb = new SelectBox<E>(skin.get(SelectBoxStyle.class));
sb.setItems(values);
sb.setSelected(selected);
sb.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
lis.accept(sb.getSelected());
}
});
Cell<SelectBox<E>> right = table.add(sb).minHeight(sb.getMinHeight()).prefHeight(sb.getMinHeight());
if (nbColumns > 2)
right.colspan(nbColumns - 1);
table.row();
}
示例3: addBooleanSelectBox
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
public void addBooleanSelectBox(String label, boolean selected, Consumer<Boolean> lis) {
LabelStyle style = skin.get(LabelStyle.class);
Label l = new Label(label, style);
table.add(l).minHeight(l.getMinHeight()).prefHeight(l.getPrefHeight());
SelectBox<Boolean> sb = new SelectBox<Boolean>(skin.get(SelectBoxStyle.class));
sb.setItems(Boolean.TRUE, Boolean.FALSE);
sb.setSelected(selected);
sb.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
lis.accept(sb.getSelected());
}
});
Cell<SelectBox<Boolean>> right = table.add(sb).minHeight(sb.getMinHeight()).prefHeight(sb.getMinHeight());
if (nbColumns > 2)
right.colspan(nbColumns - 1);
table.row();
}
示例4: addProperty
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
public void addProperty(String name, String selected, String[] value) {
table.row();
table.add(new Label(name, skin)).expandX().left();
SelectBox<String> sb = new SelectBox<String>(skin);
sb.setItems(value);
if (selected != null)
sb.setSelected(selected);
sb.setName(name);
table.add(sb).expandX().left();
sb.addListener(new ChangeListener() {
@SuppressWarnings("unchecked")
@Override
public void changed(ChangeEvent event, Actor actor) {
updateModel(actor.getName(), ((SelectBox<String>) actor).getSelected());
}
});
}
示例5: getActor
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
@Override
public Actor getActor(VisualSettingManager visualSettingManager) {
final SelectBox<String> selectBox = new SelectBox<String>(visualSettingManager.getSkin());
selectBox.setItems(options);
selectBox.setSelected(selected);
selectBox.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
if (!(event instanceof SettingsMenu.SaveEvent)) return false;
set(selectBox.getSelected());
return true;
}
});
return selectBox;
}
示例6: createDropDown
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
public SelectBox<String> createDropDown(final String selected, final Collection<String> items) {
Skin _skin = this.manager.getSkin();
final SelectBox<String> selectBox = new SelectBox<String>(_skin);
selectBox.setItems(((String[])Conversions.unwrapArray(items, String.class)));
selectBox.setSelected(selected);
return selectBox;
}
示例7: ColorAttributeForm
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
public ColorAttributeForm(Skin skin, String title, final ColorAttribute colorAttribute, final ColorAttributeChangeListener listener) {
super(skin, title, colorAttribute.color, new ColorChangeListener() {
@Override
public void onColorChange(float r, float g, float b) {
colorAttribute.color.r = r;
colorAttribute.color.g = g;
colorAttribute.color.b = b;
listener.onColorAttributeChange(colorAttribute);
}
}, null);
row();
add(new Label("Attribute", skin));
final SelectBox<String> attributeSelection = new SelectBox<String>(skin);
attributeSelection.setItems(
ColorAttribute.DiffuseAlias,
ColorAttribute.SpecularAlias,
ColorAttribute.AmbientAlias,
ColorAttribute.EmissiveAlias,
ColorAttribute.ReflectionAlias,
ColorAttribute.AmbientLightAlias,
ColorAttribute.FogAlias
);
attributeSelection.setSelected(ColorAttribute.DiffuseAlias);
attributeSelection.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
String selectedType = attributeSelection.getSelected();
long attributeType = ColorAttribute.getAttributeType(selectedType);
listener.onColorAttributeChange(new ColorAttribute(attributeType, colorAttribute.color));
}
});
add(attributeSelection);
titleLabel.setText("ColorAttribute");
pad(10);
pack();
}
示例8: construct
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
private void construct() {
getContentTable().clear();
partnertsboxes.clear();
getTitleLabel().setText(task.getDescription());
int numberPartners = task.getNumberPartners();
Array<String> partnerts = task.getPartners();
if(numberPartners > 0) {
getContentTable().add(partnerLabel);
for(int index = 0; index < numberPartners; ++index) {
SelectBox<String> partnertsBox = new SelectBox<String>(Resources.skin);
partnertsBox.setItems(users);
partnertsBox.setSelectedIndex(index);
if(partnerts.size > index) {
String partnerString = partnerts.get(index);
partnertsBox.setSelected(partnerString);
}
if(index > 0) {
Label otherPartnerLabel = new Label("und", Resources.skin);
getContentTable().add(otherPartnerLabel);
}
if(index == 2) {
getContentTable().row();
getContentTable().add(new Label("", Resources.skin));
}
partnertsboxes.add(partnertsBox);
getContentTable().add(partnertsBox).width(226).right();
}
}
getContentTable().row();
if(task.getWhatArray().size > 0) {
getContentTable().add(whatLabel);
whatBox.setItems(task.getWhatArray());
if(!task.getWhat().equals("")) {
whatBox.setSelected(task.getWhat());
}
getContentTable().add(whatBox).width(226).row();
}
locationText.setText(task.getLocation());
getContentTable().add(locationLabel);
getContentTable().add(locationText).width(226).row();
if(task.getWhereArray().size > 0) {
getContentTable().add(whereLabel);
whereBox.setItems(task.getWhereArray());
if(!task.getWhere().equals("")) {
whereBox.setSelected(task.getWhere());
}
getContentTable().add(whereBox).width(226);
}
}