當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。