List of usage examples for com.badlogic.gdx.scenes.scene2d.ui TextField next
public void next(boolean up)
From source file:com.strategames.ui.dialogs.TextInputDialog.java
License:Open Source License
private Table createInputField(final String name) { if (inputFieldValues.get(name) != null) { return null; }//from w w w . j a v a2 s.c om inputFieldValues.put(name, new StringBuffer()); Table table = new Table(getSkin()); TextField tf = new TextField("", getSkin()); tf.setName(name); tf.setTextFieldListener(new TextFieldListener() { @Override public void keyTyped(TextField textField, char key) { if (key == '\r' || key == '\n') { textField.next(true); } else { inputFieldValues.get(name).append(key); } } }); Label label = new Label(name, getSkin()); table.add(label); table.add(tf).width(200).right(); return table; }
From source file:kyle.game.besiege.MainMenuScreen.java
License:Open Source License
private void clickNew() { topTable.clear();/*from ww w. jav a2 s . c om*/ topTable.add(labelTitle).colspan(2).padBottom(PAD); topTable.row(); Label prompt = new Label("Who are you?", styleButtons); topTable.add(prompt).expandX().center().colspan(2); topTable.row(); TextFieldStyle tfs = new TextFieldStyle(); tfs.fontColor = Color.WHITE; tfs.font = Assets.pixel64; TextField tf = new TextField("", tfs); TextField tf2 = new TextField("", tfs); tf2.setVisible(false); topTable.add(tf).expandX().center().colspan(2).width(300); tf.setMaxLength(MAX_NAME); topTable.row(); topTable.add(tf2).colspan(2).height(0); // needed to autoselect tf.next(true); tf.setTextFieldFilter(new TextFieldFilter() { public boolean acceptChar(TextField textField, char key) { return true; } }); tf.addListener(new InputListener() { public boolean keyDown(InputEvent event, int keyCode) { if (keyCode == Input.Keys.ENTER) enterName(((TextField) event.getTarget()).getText()); return true; } }); tf2.next(false); }
From source file:kyle.game.besiege.title.MainMenuScreen.java
License:Open Source License
private void clickNew() { topTable.clear();/*from w w w . j a v a 2 s. c o m*/ topTable.add(labelTitle).colspan(2).padBottom(PAD); topTable.row(); Label prompt = new Label("Who are you?", styleButtons); topTable.add(prompt).expandX().center().colspan(2); topTable.row(); TextFieldStyle tfs = new TextFieldStyle(); tfs.fontColor = Color.WHITE; tfs.font = Assets.pixel64; tf = new TextField("", tfs); TextField tf2 = new TextField("", tfs); tf2.setVisible(false); topTable.add(tf).center().colspan(2); tf.setMaxLength(MAX_NAME); topTable.row(); topTable.add(tf2).colspan(2).height(0); // needed to autoselect tf.next(true); tf.setTextFieldFilter(new TextFieldFilter() { public boolean acceptChar(TextField textField, char key) { expand(); // System.out.println("Hello"); return true; } }); tf.addListener(new InputListener() { public boolean keyDown(InputEvent event, int keyCode) { if (keyCode == Input.Keys.ENTER) enterName(((TextField) event.getTarget()).getText()); return true; } }); tf2.next(false); }