Java 类com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener 实例源码

项目:gdx-lml    文件:TextFieldListenerLmlAttribute.java   
@Override
public void process(final LmlParser parser, final LmlTag tag, final TextField actor,
        final String rawAttributeData) {
    final ActorConsumer<?, Character> listener = parser.parseAction(rawAttributeData, Character.valueOf(' '));
    if (listener == null) {
        parser.throwErrorIfStrict(
                "Text field listener attribute requires ID of an action that consumes a Character. Valid action not found for name: "
                        + rawAttributeData);
        return;
    }
    actor.setTextFieldListener(new TextFieldListener() {
        @Override
        public void keyTyped(final TextField textField, final char character) {
            listener.consume(character);
        }
    });
}
项目:ShapeOfThingsThatWere    文件:FramedMenu.java   
public void addTextField(String label, Object value, TextFieldListener lis) {
  Label l = new Label(label, skin.get(LabelStyle.class));
  table.add(l).minHeight(l.getMinHeight()).prefHeight(l.getPrefHeight());

  TextField t = new TextField(String.valueOf(value), skin.get(TextFieldStyle.class));
  t.setTextFieldListener(lis);
  t.setDisabled(false);
  t.setMaxLength(6);
  if (value instanceof Number)
    t.setTextFieldFilter((textField, c) -> Character.isDigit(c));
  table.add(t).right().padLeft(1f);

  table.row();
}
项目:gaiasky    文件:FileChooser.java   
public FileChooser(String title, final Skin skin, FileHandle baseDir) {
    super(title, skin);
    this.skin = skin;
    this.baseDir = baseDir;

    final Table content = getContentTable();
    content.top().left();

    fileListLabel = new Label("", skin);
    fileListLabel.setAlignment(Align.left);

    fileList = new List<FileListItem>(skin, "light");
    fileList.getSelection().setProgrammaticChangeEvents(false);

    fileNameInput = new TextField("", skin);
    fileNameLabel = new Label("File name:", skin);
    fileNameInput.setTextFieldListener(new TextFieldListener() {
        @Override
        public void keyTyped(TextField textField, char c) {
            result = textField.getText();
        }
    });

    ok = new TextButton("Ok", skin);
    button(ok, true);

    cancel = new TextButton("Cancel", skin);
    button(cancel, false);
    key(Keys.ENTER, true);
    key(Keys.ESCAPE, false);

    fileList.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            final FileListItem selected = fileList.getSelected();
            result = selected.name;
            fileNameInput.setText(result);
        }
    });
}