Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.List#setItems()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.List#setItems() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SteeringBehaviorsTest.java    From gdx-ai with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: BehaviorTreeTests.java    From gdx-ai with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: PathFinderTests.java    From gdx-ai with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: MessageTests.java    From gdx-ai with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 5
Source File: UIUtils.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
public static List<String> newListBox (String[] items, ChangeListener listener) {
	List<String> list = new List<String>(Art.scrSkin);
	if (listener != null) {
		list.addListener(listener);
	}

	list.setItems(items);
	return list;
}
 
Example 6
Source File: TrackListPanel.java    From gdx-soundboard with MIT License 4 votes vote down vote up
private void updateTrackList(List<Track> trackList, final MusicState state) {
    trackList.getItems().clear();
    trackList.setItems(state.getTracks());
    trackList.getItems().sort(comparator);
}