本文整理汇总了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);
}
});
}
示例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;
}
示例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());
}
}