當前位置: 首頁>>代碼示例>>Java>>正文


Java List.setItems方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.List.setItems方法的典型用法代碼示例。如果您正苦於以下問題:Java List.setItems方法的具體用法?Java List.setItems怎麽用?Java List.setItems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.scenes.scene2d.ui.List的用法示例。


在下文中一共展示了List.setItems方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addElementsInList

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
private void addElementsInList(Element element, List list) {
	Array<String> items = new Array<String>();

	int childCount = element.getChildCount();
	for (int x = 0; x < childCount; x++) {
		Element child = element.getChild(x);
		if (!child.getName().equalsIgnoreCase("list-element"))
			continue;
		// Gdx.app.log("JXmlUi", "addListElement");
		String text = child.getAttribute("text");
		items.add(text);

	}

	list.setItems(items);
}
 
開發者ID:Radomiej,項目名稱:JavityEngine,代碼行數:17,代碼來源:JXmlUi.java

示例2: createTestList

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
private List<String> createTestList (final int engineIndex) {
	// Create test names
	int numTests = tests[engineIndex].length;
	String[] testNames = new String[numTests];
	for (int i = 0; i < numTests; i++) {
		testNames[i] = tests[engineIndex][i].testName;
	}

	final List<String> testList = new List<String>(skin);
	testList.setItems(testNames);
	testList.addListener(new ClickListener() {
		@Override
		public void clicked (InputEvent event, float x, float y) {
			if (!testSelectionWindow.isCollapsed() && getTapCount() == 2) {
				changeTest(engineIndex, testList.getSelectedIndex());
				testSelectionWindow.collapse();
			}
		}
	});
	return testList;
}
 
開發者ID:libgdx,項目名稱:gdx-ai,代碼行數:22,代碼來源:SteeringBehaviorsTest.java

示例3: createTestList

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
private List<String> createTestList () {
	// Create behavior names
	int numTests = tests.length;
	String[] testNames = new String[numTests];
	for (int i = 0; i < numTests; i++) {
		testNames[i] = tests[i].getName();
	}

	final List<String> testList = new List<String>(skin);
	testList.setItems(testNames);
	testList.addListener(new ClickListener() {
		@Override
		public void clicked (InputEvent event, float x, float y) {
			changeTest(testList.getSelectedIndex());
		}
	});
	return testList;
}
 
開發者ID:libgdx,項目名稱:gdx-ai,代碼行數:19,代碼來源:BehaviorTreeTests.java

示例4: createTestList

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
private List<String> createTestList () {
	// Create behavior names
	int numBehaviors = tests.length;
	String[] algorithmNames = new String[numBehaviors];
	for (int i = 0; i < numBehaviors; i++) {
		algorithmNames[i] = tests[i].testName;
	}

	final List<String> algorithmList = new List<String>(skin);
	algorithmList.setItems(algorithmNames);
	algorithmList.addListener(new ClickListener() {
		@Override
		public void clicked (InputEvent event, float x, float y) {
			if (!algorithmSelectionWindow.isCollapsed() && getTapCount() == 2) {
				changeTest(algorithmList.getSelectedIndex());
				algorithmSelectionWindow.collapse();
			}
		}
	});
	return algorithmList;
}
 
開發者ID:libgdx,項目名稱:gdx-ai,代碼行數:22,代碼來源:PathFinderTests.java

示例5: createTestList

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
private List<String> createTestList () {
	// Create behavior names
	int numTests = tests.length;
	String[] testNames = new String[numTests];
	for (int i = 0; i < numTests; i++) {
		testNames[i] = tests[i].testName;
	}

	final List<String> testList = new List<String>(skin);
	testList.setItems(testNames);
	testList.addListener(new ClickListener() {
		@Override
		public void clicked (InputEvent event, float x, float y) {
			if (!testSelectionWindow.isCollapsed() && getTapCount() == 2) {
				changeTest(testList.getSelectedIndex());
				testSelectionWindow.collapse();
			}
		}
	});
	return testList;
}
 
開發者ID:libgdx,項目名稱:gdx-ai,代碼行數:22,代碼來源:MessageTests.java

示例6: NewGameTable

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
/**
 * Expands on button click to give the player the option to choose their
 * color, and start a new game as the chosen color.
 * 
 * @param skin
 * @param core
 *            the foundation of the game, contains a function to revert the
 *            game to the launch state
 */
NewGameTable(Skin skin, final GameCore core) {

	String[] colors = new String[] { "              white", "              black" };

	TextButton newGame = new TextButton("New Game", skin, MenuSkin.IB_NEW);
	Label mColorLabel = new Label("Color:", skin, MenuSkin.LB_LARGE);
	final List<String> mColor = new List<String>(skin, MenuSkin.LS_COLOR_CHOOSER);
	TextButton mStartGame = new TextButton("Start", skin);

	mColorLabel.setAlignment(Align.center);
	mColor.setItems(colors);

	mStartGame.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			if (mColor.getSelectedIndex() == 0) {
				core.newGame(true);
			} else {
				core.newGame(false);
			}
		}
	});

	int screenWidth = Gdx.graphics.getWidth();
	int screenHeight = Gdx.graphics.getHeight();

	add(newGame).colspan(2).width((screenHeight / 3) * 0.9f);
	row().fill();
	add(mColorLabel).fill();
	add(mColor).fill();
	row();
	add(mStartGame).colspan(2).width((screenHeight / 3) * 0.9f);

	pack();

	setPosition(screenWidth + ((screenHeight / 3) * 0.05f), screenHeight - getHeight() - (getHeight() * 0.1f));
}
 
開發者ID:nkarasch,項目名稱:ChessGDX,代碼行數:47,代碼來源:NewGameTable.java

示例7: OpenGameDialogActor

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
public OpenGameDialogActor(Skin skin, final TeacherGame game, TextButton thisButton) {
	super(skin, game, thisButton);
	
	actionButton = new TextButton("Close Game", skin, "textButtonLargeRed");
	Label nameLabel = new Label("Game name: " + game.getName(), skin);
	Label passwordLabel = new Label("Password: " + game.getPassword(), skin);
	
	Table tasksBoxTable = new Table(skin);
	ScrollWindow tasksBoxWindow = new ScrollWindow("TASKS LIST", skin, tasksBoxTable);
	List<String> tasksBox = new List<String>(Resources.skin);
	tasksBox.setItems(tasksToTaskBox(game.getTasks()));
	Table usersBoxTable = new Table(skin);
	ScrollWindow usersBoxWindow = new ScrollWindow("USERS LIST", skin, usersBoxTable);
	List<String> usersBox = new List<String>(Resources.skin);
	usersBox.setItems(game.getUsers());
	
	getButtonTable().defaults().width(175).height(100);
	
	tasksBoxTable.add(tasksBox).expand().fill();
	usersBoxTable.add(usersBox).expand().fill();
	
	getContentTable().padTop(40);
	getContentTable().add(nameLabel).colspan(2).row();
	getContentTable().add(passwordLabel).colspan(2).padBottom(10).row();
	getContentTable().add(tasksBoxWindow).padTop(8).width(300).height(250).padRight(15);
	getContentTable().add(usersBoxWindow).padTop(8).width(300).height(250);
	getButtonTable().padTop(30);
	button(actionButton, "OK");
}
 
開發者ID:javosuher,項目名稱:Terminkalender,代碼行數:30,代碼來源:OpenGameDialogActor.java

示例8: addElement

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
public static <T> void addElement(T addItem, List<T> list) {
	Array<T> items = new Array<T>(list.getItems());
	items.add(addItem);
	list.setItems(items);
}
 
開發者ID:Radomiej,項目名稱:JavityEngine,代碼行數:6,代碼來源:ListHelper.java

示例9: removeElement

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
public static <T> void removeElement(T removeItem, boolean identity, List<T> list) {
	Array<T> items = new Array<T>(list.getItems());
	items.removeValue(removeItem, identity);
	list.setItems(items);
}
 
開發者ID:Radomiej,項目名稱:JavityEngine,代碼行數:6,代碼來源:ListHelper.java

示例10: create

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
@Override
public void create () {
	Gdx.gl.glClearColor(.3f, .3f, .3f, 1);
	renderer = new ShapeRenderer();

	skin = new Skin(Gdx.files.internal("data/uiskin.json"));

	stage = new Stage(new ScreenViewport());
	resetPositions();

	Field[] interpolationFields = ClassReflection.getFields(Interpolation.class);

	// see how many fields are actually interpolations (for safety; other fields may be added with future)
	int interpolationMembers = 0;
	for (int i = 0; i < interpolationFields.length; i++)
		if (Interpolation.class.isAssignableFrom(interpolationFields[i].getDeclaringClass())) interpolationMembers++;

	// get interpolation names
	interpolationNames = new String[interpolationMembers];
	for (int i = 0; i < interpolationFields.length; i++)
		if (Interpolation.class.isAssignableFrom(interpolationFields[i].getDeclaringClass()))
			interpolationNames[i] = interpolationFields[i].getName();
	selectedInterpolation = interpolationNames[0];

	list = new List(skin);
	list.setItems(interpolationNames);
	list.addListener(new ChangeListener() {
		public void changed (ChangeEvent event, Actor actor) {
			selectedInterpolation = list.getSelected();
			time = 0;
			resetPositions();
		}
	});

	ScrollPane scroll = new ScrollPane(list, skin);
	scroll.setFadeScrollBars(false);
	scroll.setScrollingDisabled(true, false);

	table = new Table();
	table.setFillParent(true);
	table.add(scroll).expandX().left().width(100);
	stage.addActor(table);

	Gdx.input.setInputProcessor(new InputMultiplexer(new InputAdapter() {
		public boolean scrolled (int amount) {
			if (!Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) return false;
			duration -= amount / 15f;
			duration = MathUtils.clamp(duration, 0, Float.POSITIVE_INFINITY);
			return true;
		}

	}, stage, new InputAdapter() {
		public boolean touchDown (int screenX, int screenY, int pointer, int button) {
			if (!Float.isNaN(time)) // if "walking" was interrupted by this touch down event
				startPosition.set(getPosition(time)); // set startPosition to the current position
			targetPosition.set(stage.screenToStageCoordinates(targetPosition.set(screenX, screenY)));
			time = 0;
			return true;
		}

	}));
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:63,代碼來源:InterpolationTest.java

示例11: setUI

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
@Override
public void setUI(final PinnableWindow window, Object... params) {
	window.row().pad(0).colspan(50).padRight(-10).fillX();
	final List<Job> jobs = new List<Job>(Vloxlands.skin);
	jobs.setItems(new IdleJob(this));
	jobs.addAction(new Action() {
		@Override
		public boolean act(float delta) {
			if (jobQueue.size == 0 && jobs.getItems().get(0) instanceof IdleJob) return false;
			
			if (!jobQueue.equals(jobs.getItems())) {
				if (jobQueue.size > 0) jobs.setItems(jobQueue);
				else jobs.setItems(new IdleJob(Human.this));
				
				jobs.getSelection().setDisabled(true);
				jobs.setSelectedIndex(-1);
				window.pack();
			}
			
			return false;
		}
	});
	jobs.getSelection().setDisabled(true);
	jobs.setSelectedIndex(-1);
	jobs.getStyle().selection.setLeftWidth(10);
	jobs.getStyle().selection.setTopHeight(3);
	final ScrollPane jobsWrap = new ScrollPane(jobs, Vloxlands.skin);
	jobsWrap.setVisible(false);
	jobsWrap.setScrollbarsOnTop(false);
	jobsWrap.setFadeScrollBars(false);
	final Cell<?> cell = window.add(jobsWrap).height(0);
	
	window.row();
	ItemSlot tool = new ItemSlot(window.getStage(), this.tool);
	window.left().add(tool).spaceRight(2);
	
	ItemSlot slot = new ItemSlot(window.getStage(), carryingItemStack);
	window.add(slot).spaceRight(2);
	
	ItemSlot armor = new ItemSlot(window.getStage(), new ItemStack());
	window.add(armor).spaceRight(2);
	
	ImageButtonStyle style = new ImageButtonStyle(Vloxlands.skin.get("image_toggle", ButtonStyle.class));
	style.imageUp = Vloxlands.skin.getDrawable("queue");
	style.imageUp.setMinWidth(ItemSlot.size);
	style.imageUp.setMinHeight(ItemSlot.size);
	style.imageDown = Vloxlands.skin.getDrawable("queue");
	style.imageDown.setMinWidth(ItemSlot.size);
	style.imageDown.setMinHeight(ItemSlot.size);
	final TooltipImageButton job = new TooltipImageButton(style);
	window.getStage().addActor(job.getTooltip());
	job.setName("job");
	ClickListener cl = new ClickListener() {
		@Override
		public void clicked(InputEvent event, float x, float y) {
			cell.height(cell.getMinHeight() == 100 ? 0 : 100);
			jobsWrap.setVisible(!jobsWrap.isVisible());
			window.invalidateHierarchy();
			window.pack();
		}
	};
	job.addListener(cl);
	job.getTooltip().set("Job Queue", "Toggle Job Queue display");
	window.add(job).padRight(-10);
	
	if (params[0] == Boolean.TRUE) {
		job.setChecked(true);
		cl.clicked(null, 0, 0);
	}
}
 
開發者ID:Dakror,項目名稱:Vloxlands,代碼行數:71,代碼來源:Human.java

示例12: updateTrackList

import com.badlogic.gdx.scenes.scene2d.ui.List; //導入方法依賴的package包/類
private void updateTrackList(List<Track> trackList, final MusicState state) {
    trackList.getItems().clear();
    trackList.setItems(state.getTracks());
    trackList.getItems().sort(comparator);
}
 
開發者ID:ollipekka,項目名稱:gdx-soundboard,代碼行數:6,代碼來源:TrackListPanel.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.List.setItems方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。