本文整理匯總了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());
}
}