当前位置: 首页>>代码示例>>Java>>正文


Java SelectBox.setItems方法代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.SelectBox.setItems方法的典型用法代码示例。如果您正苦于以下问题:Java SelectBox.setItems方法的具体用法?Java SelectBox.setItems怎么用?Java SelectBox.setItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.scenes.scene2d.ui.SelectBox的用法示例。


在下文中一共展示了SelectBox.setItems方法的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;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:17,代码来源:DropDownSetting.java

示例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);
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:23,代码来源:ParticleEffectViewer.java

示例3: 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);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:27,代码来源:MipMapTest.java

示例4: 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();
}
 
开发者ID:guillaume-alvarez,项目名称:ShapeOfThingsThatWere,代码行数:21,代码来源:FramedMenu.java

示例5: 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();
}
 
开发者ID:guillaume-alvarez,项目名称:ShapeOfThingsThatWere,代码行数:21,代码来源:FramedMenu.java

示例6: 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());
		}
	});
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:21,代码来源:PropertyTable.java

示例7: createWidget

import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
@Override
public AbstractWidget createWidget(Controller controller) {
	Skin skin = controller.getApplicationAssets().getSkin();
	LinearLayout bottomLayout = new LinearLayout(false);
	label = new Label("Stopped", skin);

	bottomLayout.add(label);

	SelectBox<String> selectBox = new SelectBox<String>(skin);
	selectBox.setItems("Just", "a", "drop", "down", "list", "to", "check",
			"that", "UI", "doesn't", "freeze");

	TextButton textButton = new TextButton("Run", skin);
	textButton.addListener(new ClickListener() {
		@Override
		public void clicked(InputEvent event, float x, float y) {
			Gdx.app.postRunnable(launchBackgroundProcess);
		}
	});

	bottomLayout.add(selectBox);
	bottomLayout.add(textButton);
	return bottomLayout;
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:25,代码来源:BackgroundTaskDemo.java

示例8: setupUI

import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
private void setupUI() {
	stage = new Stage(new ScreenViewport(), quad2dBatch);
	skin = new Skin(Gdx.files.internal("uiskin.json"));

	final SelectBox<Test> selectBox = new SelectBox<Test>(skin);
	selectBox.setItems(Test.values());
	selectBox.addListener(new ChangeListener() {
		public void changed(ChangeEvent event, Actor actor) {
			test = selectBox.getSelected();
			elapsed = 0;
		}
	});
	Table table = new Table();
	table.setFillParent(true);
	table.defaults().padTop(5).left();
	table.top().left().padLeft(5);
	table.add(selectBox).row();
	table.add(new Label("", skin) {
		int fps = -1;

		public void act(float delta) {
			super.act(delta);
			if (Gdx.graphics.getFramesPerSecond() != fps) {
				fps = Gdx.graphics.getFramesPerSecond();
				setText("" + fps);
			}
		}
	}).row();
	stage.addActor(table);
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:31,代码来源:FlexBatchTest.java

示例9: 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;
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:16,代码来源:DropDownSetting.java

示例10: loadClasses

import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
@Override
public void loadClasses(SelectBox classSelectBox) {
    Array names = new Array<>();
    for (Class clazz : Main.BASIC_CLASSES) {
        names.add(clazz.getSimpleName());
    }
    for (CustomClass customClass : main.getJsonData().getCustomClasses()) {
        names.add(customClass);
    }
    classSelectBox.setItems(names);
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:12,代码来源:MainListener.java

示例11: loadStyles

import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
@Override
public void loadStyles(SelectBox classSelectBox, SelectBox styleSelectBox) {
    int selection = classSelectBox.getSelectedIndex();
    if (selection < Main.BASIC_CLASSES.length) { 
        Class selectedClass = Main.BASIC_CLASSES[selection];
        styleSelectBox.setItems(jsonData.getClassStyleMap().get(selectedClass));
        styleSelectBox.setSelectedIndex(0);
    } else {
        CustomClass customClass = (CustomClass) classSelectBox.getSelected();
        styleSelectBox.setItems(customClass.getStyles());
    }
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:13,代码来源:MainListener.java

示例12: NoiseSamplerForm

import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
public NoiseSamplerForm(Skin skin, AbstractSampler sampler, Samplers pool) {
	super(skin, sampler, pool);
	this.skin = skin;
	defaults().center().pad(5);
	setBackground(Styles.INNER_BACKGROUND);


	Label algorithmLabel = new Label("algorithm", skin);
	add(algorithmLabel);

	algorithmSelect = new SelectBox(skin);
	String[] algorithmNames = new String[Editor.KNOWN_ALGORITHMS.keySet().size()];
	Editor.KNOWN_ALGORITHMS.keySet().toArray(algorithmNames);
	algorithmSelect.setItems(algorithmNames);
	algorithmSelect.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			notifyChanges();
		}
	});

	add(algorithmSelect);


	loadFromConfig(sampler.getConfig());
	notifyChanges();
}
 
开发者ID:aphex-,项目名称:Opus-Prototype,代码行数:28,代码来源:NoiseSamplerForm.java

示例13: NewSamplerDialog

import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
public NewSamplerDialog(Skin skin) {
	super("Create new sampler", skin);


	Label nameLabel = new Label("Name", skin);
	getContentTable().add(nameLabel);
	nameField = new TextField("default", skin);
	getContentTable().pad(2);
	getContentTable().add(nameField);
	getContentTable().row();

	selectBox = new SelectBox(skin);
	String[] samplerNames = new String[Samplers.SAMPLER_TO_CONFIG.size()];
	int i = 0;
	for (Class c : Samplers.SAMPLER_TO_CONFIG.keySet()) {
		samplerNames[i] = c.getSimpleName();
		i++;
	}
	selectBox.setItems(samplerNames);
	Label typeLabel = new Label("Type", skin);
	getContentTable().add(typeLabel);
	getContentTable().add(selectBox);

	key(Input.Keys.ENTER, true);
	key(Input.Keys.ESCAPE, false);
	button("create", true);
	button("cancel", false);
}
 
开发者ID:aphex-,项目名称:Opus-Prototype,代码行数:29,代码来源:NewSamplerDialog.java

示例14: 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;
}
 
开发者ID:CymricNPG,项目名称:abattle,代码行数:8,代码来源:Widgets.java

示例15: setupUI

import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
public void setupUI () {
	ui = new Stage();
	skin = new Skin(Gdx.files.internal("data/uiskin.json"));
	TextButton reload = new TextButton("Reload Shaders", skin.get(TextButtonStyle.class));
	camera = new SelectBox(skin.get(SelectBoxStyle.class));
	camera.setItems("Camera", "Light");
	fps = new Label("fps: ", skin.get(LabelStyle.class));

	Table table = new Table();
	table.setFillParent(true);
	table.top().padTop(15);
	table.add(reload).spaceRight(5);
	table.add(camera).spaceRight(5);
	table.add(fps);
	ui.addActor(table);

	reload.addListener(new ClickListener() {
		public void clicked (InputEvent event, float x, float y) {
			ShaderProgram prog = new ShaderProgram(Gdx.files.internal("data/shaders/projtex-vert.glsl").readString(), Gdx.files
				.internal("data/shaders/projtex-frag.glsl").readString());
			if (prog.isCompiled() == false) {
				Gdx.app.log("GLSL ERROR", "Couldn't reload shaders:\n" + prog.getLog());
			} else {
				projTexShader.dispose();
				projTexShader = prog;
			}
		}
	});
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:30,代码来源:ProjectiveTextureTest.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.SelectBox.setItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。