本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.List類的典型用法代碼示例。如果您正苦於以下問題:Java List類的具體用法?Java List怎麽用?Java List使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
List類屬於com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了List類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addList
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入依賴的package包/類
private void addList(Table table, Element element) {
Gdx.app.log("JXmlUi", "addList");
ObjectMap<String, String> atrributes = element.getAttributes();
if (atrributes == null)
atrributes = new ObjectMap<String, String>();
List<String> list = new List<String>(skin);
list.getSelection().setMultiple(false);
ScrollPane scrollPane = new ScrollPane(list, skin);
Cell<ScrollPane> cell = table.add(scrollPane);
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
list.setName(atrributes.get(key));
scrollPane.setName(atrributes.get(key) + "-scroll-panel");
}
}
cellPrepare(cell, atrributes);
actorsMap.put(list.getName(), list);
actorsMap.put(scrollPane.getName(), scrollPane);
addElementsInList(element, list);
}
示例2: 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);
}
示例3: process
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入依賴的package包/類
@Override
public void process(final LmlParser parser, final LmlTag tag, final List<?> 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.
((List<String>) actor).setSelected(parser.parseString(rawAttributeData, actor));
}
return null;
}
});
}
示例4: addListWindow
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入依賴的package包/類
protected CollapsableWindow addListWindow (String title, List list, float x, float y) {
CollapsableWindow window = new CollapsableWindow(title, skin);
window.row();
ScrollPane pane = new ScrollPane(list, skin);
pane.setFadeScrollBars(false);
window.add(pane);
window.pack();
window.pack();
if (window.getHeight() > hudHeight) {
window.setHeight(hudHeight);
}
window.setX(x < 0 ? hudWidth - (window.getWidth() - (x + 1)) : x);
window.setY(y < 0 ? hudHeight - (window.getHeight() - (y + 1)) : y);
window.layout();
window.collapse();
hud.addActor(window);
pane.setScrollX(0);
pane.setScrollY(0);
return window;
}
示例5: setupUi
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入依賴的package包/類
private void setupUi () {
// setup a tiny ui with a console and a clear button.
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
stage = new Stage();
ui = new Table();
ui.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
console = new List(skin);
scrollPane = new ScrollPane(console);
scrollPane.setScrollbarsOnTop(true);
TextButton clear = new TextButton("Clear", skin);
ui.add(scrollPane).expand(true, true).fill();
ui.row();
ui.add(clear).expand(true, false).fill();
stage.addActor(ui);
clear.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
clear();
}
});
Gdx.input.setInputProcessor(stage);
}
示例6: addTask
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入依賴的package包/類
private void addTask(String taskName, String taskLimit, String whatString, String whereString, List<String> list) {
if(!taskName.equals("") && validateFieldString(taskName)) {
boolean add = true;
String task = taskName + " [" + taskLimit + "]";
if(validateTaskSecondaryFieldString(whatString)) {
task = task + " [" + whatString + "]";
}
else add = false;
taskWhatText.setText("");
if(validateTaskSecondaryFieldString(whereString)) {
task = task + " [" + whereString + "]";
}
else add = false;
taskWhereText.setText("");
if(add) {
addInList(task, list);
}
}
}
示例7: doClick
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入依賴的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);
}
}
示例8: setup
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入依賴的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());
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: addBehaviorSelectionWindow
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入依賴的package包/類
protected CollapsableWindow addBehaviorSelectionWindow (String title, List<String> testList, float x, float y) {
CollapsableWindow window = new CollapsableWindow(title, skin);
window.row();
ScrollPane pane = new ScrollPane(testList, skin);
pane.setFadeScrollBars(false);
pane.setScrollX(0);
pane.setScrollY(0);
window.add(pane);
window.pack();
window.pack();
if (window.getHeight() > stage.getHeight()) {
window.setHeight(stage.getHeight());
}
window.setX(x < 0 ? stage.getWidth() - (window.getWidth() - (x + 1)) : x);
window.setY(y < 0 ? stage.getHeight() - (window.getHeight() - (y + 1)) : y);
window.layout();
window.collapse();
stage.addActor(window);
return window;
}
示例13: 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;
}
示例14: addTestSelectionWindow
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入依賴的package包/類
protected CollapsableWindow addTestSelectionWindow (String title, List<String> testList, float x, float y) {
CollapsableWindow window = new CollapsableWindow(title, skin);
window.row();
ScrollPane pane = new ScrollPane(testList, skin);
pane.setFadeScrollBars(false);
pane.setScrollX(0);
pane.setScrollY(0);
window.add(pane);
window.pack();
window.pack();
if (window.getHeight() > stage.getHeight()) {
window.setHeight(stage.getHeight());
}
window.setX(x < 0 ? stage.getWidth() - (window.getWidth() - (x + 1)) : x);
window.setY(y < 0 ? stage.getHeight() - (window.getHeight() - (y + 1)) : y);
window.layout();
window.collapse();
stage.addActor(window);
return window;
}
示例15: scanSavedDecks
import com.badlogic.gdx.scenes.scene2d.ui.List; //導入依賴的package包/類
private Table scanSavedDecks(final CardshifterGame game, final List<String> savedDecks, String modName) {
if (Gdx.files.isExternalStorageAvailable()) {
Table saveTable = new Table();
external = Gdx.files.external("Cardshifter/decks/" + modName + "/");
external.mkdirs();
if (!external.exists()) {
Gdx.app.log("Files", external.path() + " does not exist.");
return null;
}
updateSavedDeckList();
saveTable.add(savedDecks).colspan(2).fill().row();
return saveTable;
}
return null;
}