当前位置: 首页>>代码示例>>Java>>正文


Java TextFieldListener类代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener的典型用法代码示例。如果您正苦于以下问题:Java TextFieldListener类的具体用法?Java TextFieldListener怎么用?Java TextFieldListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextFieldListener类属于com.badlogic.gdx.scenes.scene2d.ui.TextField包,在下文中一共展示了TextFieldListener类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener; //导入依赖的package包/类
@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);
        }
    });
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:18,代码来源:TextFieldListenerLmlAttribute.java

示例2: addTextField

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener; //导入依赖的package包/类
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();
}
 
开发者ID:guillaume-alvarez,项目名称:ShapeOfThingsThatWere,代码行数:15,代码来源:FramedMenu.java

示例3: FileChooser

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener; //导入依赖的package包/类
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);
        }
    });
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:41,代码来源:FileChooser.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。