本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.SelectBox类的典型用法代码示例。如果您正苦于以下问题:Java SelectBox类的具体用法?Java SelectBox怎么用?Java SelectBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SelectBox类属于com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了SelectBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createDropdown
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
private void createDropdown() {
final float screenWidth = Gdx.graphics.getWidth();
final float screenHeight = Gdx.graphics.getHeight();
final SelectBox<String> dropdown = new SelectBox<String>(skin);
dropdown.setSize(screenWidth, screenHeight / 10);
dropdown.setPosition(0, screenHeight - dropdown.getHeight());
dropdown.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
inputListener.setSelectedEffectType(dropdown.getSelected());
}
});
// Load dropdown.
Array<String> effectTypes = ParticleEffectManager.getInstance().getParticleEffectTypes();
dropdown.setItems(effectTypes);
dropdown.getStyle().font = font;
stage.addActor(dropdown);
}
示例3: stylePropertyChanged
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
@Override
public void stylePropertyChanged(StyleProperty styleProperty,
Actor styleActor) {
if (styleProperty.type == Drawable.class) {
dialogFactory.showDialogDrawables(styleProperty);
} else if (styleProperty.type == Color.class) {
dialogFactory.showDialogColors(styleProperty);
} else if (styleProperty.type == BitmapFont.class) {
dialogFactory.showDialogFonts(styleProperty);
} else if (styleProperty.type == Float.TYPE) {
main.getUndoableManager().addUndoable(new UndoableManager.DoubleUndoable(main, styleProperty, ((Spinner) styleActor).getValue()), false);
} else if (styleProperty.type == ScrollPaneStyle.class) {
main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
} else if (styleProperty.type == LabelStyle.class) {
main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
} else if (styleProperty.type == ListStyle.class) {
main.getUndoableManager().addUndoable(new UndoableManager.SelectBoxUndoable(root, styleProperty, (SelectBox) styleActor), true);
}
}
示例4: GraphicsOptions
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
public GraphicsOptions (Skin skin) {
setName("Graphics");
resolutionSelectBox = new SelectBox<String>(skin);
resolutionSelectBox.setItems(GameConfig.SUPPORTED_RESOLUTIONS);
resolutionSelectBox.setSelected(OrionPrefs.getString(StringValue.GRAPHICS_RESOLUTION));
fullscreenCheckBox = new CheckBox("Fullscreen", skin);
fullscreenCheckBox.setChecked(OrionPrefs.getBoolean(BooleanValue.GRAPHICS_FULLSCREEN));
TextButton applyButton = new TextButton("Apply", skin);
applyButton.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
OrionPrefs.putBoolean(BooleanValue.GRAPHICS_FULLSCREEN, fullscreenCheckBox.isChecked());
OrionPrefs.putString(StringValue.GRAPHICS_RESOLUTION, resolutionSelectBox.getSelected());
GameManager.refreshDisplayMode();
}
});
add(resolutionSelectBox);
row();
add(fullscreenCheckBox);
row();
add(applyButton);
}
示例5: PlacedArtifactTable
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
public PlacedArtifactTable() {
setBackground(Styles.NINE_PATCH_POPUP_BG_01);
selectBox = new SelectBox<ArtifactDefinitions.ConcreteArtifactType>(Styles.UI_SKIN);
selectBox.setItems(ArtifactDefinitions.ConcreteArtifactType.values());
add(selectBox);
addButton = new TextButton("add artifact", Styles.UI_SKIN);
add(addButton);
row();
artifactContent = new Table();
scrollPane = new ScrollPane(artifactContent);
scrollPane.setFadeScrollBars(false);
add(scrollPane).colspan(2).height(200);
pack();
}
示例6: process
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final SelectBox<?> actor,
final String rawAttributeData) {
LmlUtilities.getLmlUserObject(actor).addOnCloseAction(new ActorConsumer<Object, Object>() {
@Override
@SuppressWarnings("unchecked")
public Object consume(final Object widget) {
try {
actor.setSelectedIndex(parser.parseInt(rawAttributeData, actor));
} catch (final Exception exception) {
Exceptions.ignore(exception); // Possible number format exception. Trying to select string.
((SelectBox<String>) actor).setSelected(parser.parseString(rawAttributeData, actor));
}
return null;
}
});
}
示例7: createUI
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
private void createUI () {
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
ui = new Stage();
String[] filters = new String[TextureFilter.values().length];
int idx = 0;
for (TextureFilter filter : TextureFilter.values()) {
filters[idx++] = filter.toString();
}
hwMipMap = new CheckBox("Hardware Mips", skin);
minFilter = new SelectBox(skin);
minFilter.setItems(filters);
magFilter = new SelectBox(skin.get(SelectBoxStyle.class));
magFilter.setItems("Nearest", "Linear");
Table table = new Table();
table.setSize(ui.getWidth(), 30);
table.setY(ui.getHeight() - 30);
table.add(hwMipMap).spaceRight(5);
table.add(new Label("Min Filter", skin)).spaceRight(5);
table.add(minFilter).spaceRight(5);
table.add(new Label("Mag Filter", skin)).spaceRight(5);
table.add(magFilter);
ui.addActor(table);
}
示例8: LoginActor
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
public LoginActor(Skin skin) {
super(skin);
login = new Login();
Window loginWindow = new TWindow("", skin, "window2");
Label teacherName = new Label("Lehrer", skin);
teachersSelectBox = new SelectBox<String>(skin);
TextButton loginButton = new TextButton("Start", skin, "defaultBig");
setPosition(AppMain.WIDTH / 2, 225);
loginWindow.add(teacherName).row();
loginWindow.add(teachersSelectBox).width(175).row();
loginWindow.add(loginButton).width(175).height(100).colspan(2).padTop(40);
add(loginWindow);
loginButton.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
AppMain.user.login(teachersSelectBox.getSelected());
}
});
}
示例9: sendTaskData
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
private void sendTaskData() {
String location = locationText.getText();
if(location.contains(AppWebSockets.POINTSPLIT) || location.contains(AppWebSockets.DATASPLIT) ||
location.contains(AppWebSockets.TASKSPLIT)) {
Resources.warningDialog.show("you musn't use ',', ';', or ':'", getStage());
cancelTask();
}
else {
task.setLocation(locationText.getText());
int numberPartners = partnertsboxes.size;
task.clearPartners();
for(int index = 0; index < numberPartners; ++index) {
SelectBox<String> partnertsBox = partnertsboxes.get(index);
task.addPartner(partnertsBox.getSelected());
}
if(task.getWhatArray().size > 0) {
task.setWhat(whatBox.getSelected());
}
if(task.getWhereArray().size > 0) {
task.setWhere(whereBox.getSelected());
}
task.addDataServer();
}
}
示例10: 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();
}
示例11: 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();
}
示例12: doClick
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
public static void doClick(Actor actor){
addField.remove();
Frame.actorPanel.lock();
Frame.propertyPanel.clear();
Frame.effectPanel.clear();
Frame.eventPanel.clear();
selectedActor = actor;
Scene.getCurrentScene().outline(actor);
Frame.actorPanel.list.setSelectedIndex(Frame.actorPanel.indexOf(actor.getName()));
StatusBar.updateSelected(actor.getName());
Frame.dashPanel.update();
Frame.propertyPanel.update();
Frame.effectPanel.update();
Frame.eventPanel.update();
Frame.actorPanel.unlock();
if(selectedActor instanceof List || selectedActor instanceof SelectBox){
addField.setPosition(actor.getX(), actor.getY() - addField.getHeight());
Scene.getRoot().addActor(addField);
}
}
示例13: setup
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
public static void setup(){
registerSerializer(Actor.class, new ActorSerializer());
registerSerializer(Scene.class, new SceneSerializer());
registerSerializer(ImageJson.class, new ImageJson());
registerSerializer(Label.class, new LabelSerializer());
registerSerializer(Button.class, new ButtonSerializer());
registerSerializer(TextButton.class, new TextButtonSerializer());
registerSerializer(Table.class, new TableSerializer());
registerSerializer(CheckBox.class, new CheckBoxSerializer());
registerSerializer(SelectBox.class, new SelectBoxSerializer());
registerSerializer(List.class, new ListSerializer());
registerSerializer(Slider.class, new SliderSerializer());
registerSerializer(TextField.class, new TextFieldSerializer());
registerSerializer(Touchpad.class, new TouchpadSerializer());
registerSerializer(Sprite.class, new SpriteSerializer());
registerSerializer(Dialog.class, new DialogSerializer());
registerSerializer(SplitPane.class, new SplitPaneSerializer());
registerSerializer(ScrollPane.class, new ScrollPaneSerializer());
registerSerializer(Stack.class, new StackSerializer());
registerSerializer(Tree.class, new TreeSerializer());
registerSerializer(Table.class, new TableSerializer());
registerSerializer(ButtonGroup.class, new ButtonGroupSerializer());
registerSerializer(HorizontalGroup.class, new HorizontalGroupSerializer());
registerSerializer(VerticalGroup.class, new VerticalGroupSerializer());
}
示例14: fillAnimations
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
private void fillAnimations() {
@SuppressWarnings("unchecked")
SelectBox<String> cb = (SelectBox<String>) id.getField();
cb.clearItems();
// When creating, give option to add all elements
if (e == null)
cb.getItems().add("<ADD ALL>");
String ids[] = spriteWidget.getAnimations();
for (String s : ids)
cb.getItems().add(s);
cb.getList().setItems(cb.getItems());
if (cb.getItems().size > 0)
cb.setSelectedIndex(0);
cb.invalidateHierarchy();
setAnimation();
}
示例15: ok
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入依赖的package包/类
/**
* Override to append all animations if selected.
*/
@Override
protected void ok() {
@SuppressWarnings("unchecked")
SelectBox<String> cb = (SelectBox<String>) id.getField();
if (e == null && cb.getSelectedIndex() == 0) {
for (int i = 1; i < cb.getItems().size; i++) {
cb.setSelectedIndex(i);
inputsToModel(true);
// doc.setId(e, cb.getItems().get(i));
if (listener != null)
listener.changed(new ChangeEvent(), this);
}
} else {
super.ok();
}
}