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


Java VisTextField类代码示例

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


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

示例1: createContentBox

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
private static Table createContentBox() {
    Table contentBox = new Table();

    VisTextField textField = new VisTextField();
    textField.setMessageText(Translation.get("InsNewDBName").toString());//TODO change to CharSequence

    CharSequenceCheckBox checkBox = new CharSequenceCheckBox(Translation.get("UseDefaultRep"));

    float pad = CB.scaledSizes.MARGIN;
    contentBox.add(textField).pad(pad).left().fillX();
    contentBox.row();
    contentBox.add(checkBox).pad(pad).left().fillX();
    contentBox.pack();
    contentBox.layout();
    return contentBox;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:17,代码来源:NewDB_InputBox.java

示例2: updateMapListener

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
private Listener updateMapListener(final VisTextField textField) {
	return new Listener() {

		@Override
		public void invoke() {
			// TODO: null checks
			try {
				final MapDefinition current = Editor.db().map(textField.getText());
				if (current != null) {
					definition = current;
					updateMap();
				}
			} catch (NullPointerException e) {
				// couldn't find the map, no worries -- clear any old maps out
				mapTable.clear();
			}
		}
	};
}
 
开发者ID:adketuri,项目名称:umbracraft,代码行数:20,代码来源:MapPreviewWidget.java

示例3: process

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的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

示例4: process

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final VisTextField 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 VisTextField textField, final char character) {
            listener.consume(character);
        }
    });
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:18,代码来源:TextFieldListenerLmlAttribute.java

示例5: acceptChar

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
@Override
public boolean acceptChar (VisTextField field, char c) {
	int selectionStart = field.getSelectionStart();
	int cursorPos = field.getCursorPosition();
	String text;
	if (field.isTextSelected()) { //issue #131
		String beforeSelection = field.getText().substring(0, Math.min(selectionStart, cursorPos));
		String afterSelection = field.getText().substring(Math.max(selectionStart, cursorPos));
		text = beforeSelection + afterSelection;
	} else {
		text = field.getText();
	}

	if (c == '.' && text.contains(".") == false) return true;
	return super.acceptChar(field, c);
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:17,代码来源:FloatDigitsOnlyFilter.java

示例6: createHexTable

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的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

示例7: TestIssue131

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
public TestIssue131 () {
	super("issue #131");

	TableUtils.setSpacingDefaults(this);
	columnDefaults(0).left();

	VisTextField field1 = new VisTextField("0.1234");
	VisTextField field2 = new VisTextField("4.5678");
	field1.setTextFieldFilter(new FloatDigitsOnlyFilter(true));
	field2.setTextFieldFilter(new FloatDigitsOnlyFilter(true));

	add(new LinkLabel("issue #131 - decimal point lost", "https://github.com/kotcrab/vis-editor/issues/131")).colspan(2).row();
	add(field1);
	add(field2);

	setResizable(true);
	setModal(false);
	addCloseButton();
	closeOnEscape();
	pack();
	centerWindow();
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:23,代码来源:TestIssue131.java

示例8: IndeterminateTextField

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
public IndeterminateTextField (VisValidatableTextField textField) {
	this.textField = textField;
	textField.setStyle(new VisTextField.VisTextFieldStyle(textField.getStyle()));
	textField.setProgrammaticChangeEvents(false);
	textField.addListener(new ChangeListener() {
		@Override
		public void changed (ChangeEvent event, Actor actor) {
			if (indeterminate) {
				textField.getStyle().fontColor = Color.WHITE;
				indeterminate = false;
			}

			text = textField.getText();
		}
	});
	text = textField.getText();
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:18,代码来源:IndeterminateTextField.java

示例9: getInputTextStyle

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
public TextField.TextFieldStyle getInputTextStyle(){
    if (inputTextFieldStyle == null){
        VisTextField.VisTextFieldStyle visTextFieldStyle = VisUI.getSkin().get(VisTextField.VisTextFieldStyle.class);

        inputTextFieldStyle = new TextField.TextFieldStyle(getTextInputFont(),
                Color.WHITE,
                visTextFieldStyle.cursor,
                visTextFieldStyle.selection,
                visTextFieldStyle.background
        );
    }
    return inputTextFieldStyle;
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:14,代码来源:EditorManager.java

示例10: createWidgets

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
private void createWidgets() {

        float width = Gdx.graphics.getWidth();

        if (value instanceof Integer) {
            numPad = new NumPad(numPadKeyListener, width, OK, CANCEL, DelBack);
        } else if (value instanceof Double) {
            numPad = new NumPad(numPadKeyListener, width, OK, CANCEL, DOT, DelBack);
        } else if (value instanceof Float) {
            numPad = new NumPad(numPadKeyListener, width, OK, CANCEL, DOT, DelBack);
        } else throw new NotImplementedException("Ilegal Number type");

        textField = new VisTextField(value.toString());
        textField.setOnscreenKeyboard(numPad);
    }
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:16,代码来源:NumericInput_Activity.java

示例11: KeyPressed

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
@Override
public void KeyPressed(String value) {

    if ("C".equals(value)) {
        cancelListener.clicked(StageManager.BACK_KEY_INPUT_EVENT, -1, -1);
        return;
    }

    if (actFocusField != null) {

        getStage().setKeyboardFocus(actFocusField);
        actFocusField.focusGained();
        VisTextField.TextFieldClickListener listener = (VisTextField.TextFieldClickListener) actFocusField.getDefaultInputListener();

        if (value.equals("<") || value.equals(">")) {
            if (value.equals("<")) {
                listener.keyDown(null, Input.Keys.LEFT);
            } else {
                listener.keyDown(null, Input.Keys.RIGHT);
            }
            return;
        }
        if (value.equals("D")) {
            listener.keyTyped(null, DELETE);
            return;
        }
        if (value.equals("B")) {
            listener.keyTyped(null, BACKSPACE);
            return;
        }
        listener.keyTyped(null, value.charAt(0));
    }
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:34,代码来源:ProjectionCoordinate.java

示例12: addEditLine

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
private void addEditLine(CharSequence name, final VisTextField textField, CharSequence unity) {
    Table line = new VisTable();
    line.defaults().pad(CB.scaledSizes.MARGINx2);
    line.add(name).left();


    //disable onScreenKeyboard
    textField.setOnscreenKeyboard(new TextField.OnscreenKeyboard() {
        @Override
        public void show(boolean visible) {
            // do nothing
            // we use own NumPad
        }
    });

    textField.addListener(new FocusListener() {
        public void keyboardFocusChanged(FocusListener.FocusEvent event, Actor actor, boolean focused) {
            if (focused == true) {
                if (actor == textField) {
                    actFocusField = textField;
                }
            }
        }
    });
    line.add(textField).expandX().fillX();
    line.add(unity);
    this.row();
    this.add(line).expandX().fillX();
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:30,代码来源:ProjectionCoordinate.java

示例13: isTextFitTextField

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
/** Checks if the text could fit the current textField's width. */
public static boolean isTextFitTextField(VisTextField textField, String text) {
    float availableWidth = textField.getWidth();
    Drawable fieldBg = textField.getStyle().background;
    if (fieldBg != null) {
        availableWidth = availableWidth - fieldBg.getLeftWidth() - fieldBg.getRightWidth();
    }
    BitmapFont font = textField.getStyle().font;
    return isTextFitWidth(font, availableWidth, text);
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:11,代码来源:Scene2dUtils.java

示例14: TextFieldWithLabel

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
public TextFieldWithLabel(String labelText, int width) {
    super();
    this.width = width;
    textField = new VisTextField();
    label = new VisLabel(labelText);
    setupUI();
}
 
开发者ID:mbrlabs,项目名称:Mundus,代码行数:8,代码来源:TextFieldWithLabel.java

示例15: FileChooserField

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
public FileChooserField(int width) {
    super();
    this.width = width;
    textField = new VisTextField();
    fcBtn = new VisTextButton("Select");

    setupUI();
    setupListeners();
}
 
开发者ID:mbrlabs,项目名称:Mundus,代码行数:10,代码来源:FileChooserField.java


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