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


Java TextFieldFilter类代码示例

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


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

示例1: process

import com.kotcrab.vis.ui.widget.VisTextField.TextFieldFilter; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final VisTextField actor,
        final String rawAttributeData) {
    @SuppressWarnings("unchecked") final ActorConsumer<Boolean, Character> filter = (ActorConsumer<Boolean, Character>) parser
            .parseAction(rawAttributeData, Character.valueOf(' '));
    if (filter == null) {
        parser.throwErrorIfStrict(
                "Text field filter attribute requires ID of an action that consumes a Character and returns a boolean or Boolean. Valid action not found for name: "
                        + rawAttributeData);
        return;
    }
    actor.setTextFieldFilter(new TextFieldFilter() {
        @Override
        public boolean acceptChar(final VisTextField textField, final char character) {
            return filter.consume(character);
        }
    });
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:19,代码来源:TextFieldFilterLmlAttribute.java

示例2: createHexTable

import com.kotcrab.vis.ui.widget.VisTextField.TextFieldFilter; //导入依赖的package包/类
private VisTable createHexTable () {
	VisTable table = new VisTable(true);
	table.add(new VisLabel(HEX.get()));
	table.add(hexField = new VisValidatableTextField("00000000")).width(HEX_FIELD_WIDTH * sizes.scaleFactor);
	table.row();

	hexField.setMaxLength(HEX_COLOR_LENGTH);
	hexField.setProgrammaticChangeEvents(false);
	hexField.setTextFieldFilter(new TextFieldFilter() {
		@Override
		public boolean acceptChar (VisTextField textField, char c) {
			return Character.isDigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
		}
	});

	hexField.addListener(new ChangeListener() {
		@Override
		public void changed (ChangeEvent event, Actor actor) {
			if (hexField.getText().length() == (allowAlphaEdit ? HEX_COLOR_LENGTH_WITH_ALPHA : HEX_COLOR_LENGTH)) {
				setColor(Color.valueOf(hexField.getText()), false);
			}
		}
	});

	return table;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:27,代码来源:BasicColorPicker.java

示例3: process

import com.kotcrab.vis.ui.widget.VisTextField.TextFieldFilter; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final VisTextField actor,
        final String rawAttributeData) {
    if (parser.parseBoolean(rawAttributeData, actor)) {
        actor.setTextFieldFilter(new TextFieldFilter.DigitsOnlyFilter());
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:8,代码来源:DigitsOnlyLmlAttribute.java


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