• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java VisTextField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: createPopupFields

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

		@Override
		public void invoke() {
			// see if we should really repopulate
			if (!last.equals(textField.getText())) {
				Game.log("Command changed. Attempting rebuild.");
				// see if we have a real command
				Commands localCommand = Commands.from(textField.getText());
				if (localCommand != null) {
					popupFields.clear();
					if (createdCommand == null) {
						Game.log("Setting new command");
						createdCommand = localCommand.getCommandInstance();
					}
					populate(popupFields, localCommand.getCommandClass(), createdCommand, populateConfig());
					specialPopulate(localCommand);
					buttonTable.clear();
					buttonTable.add(WidgetUtils.button("Create", commandCreated()));
				} else {
					popupFields.clear();
					createdCommand = null;
				}
			}
			last = textField.getText();
		}

	};
}
 
开发者ID:adketuri,项目名称:umbracraft,代码行数:32,代码来源:ScriptCommandWidget.java


示例17: listener

import com.kotcrab.vis.ui.widget.VisTextField; //导入依赖的package包/类
/** Updates the filters if we change the "type" dropdown
 * @param textField
 * @return */
private TypeListener<String> listener(final VisTextField textField) {
	return new TypeListener<String>() {

		@Override
		public void invoke(String type) {
			if ("type".equals(type)) {
				Commands localCommand = Commands.from(textField.getText());
				popupFields.clear();
				populate(popupFields, localCommand.getCommandClass(), createdCommand, populateConfig());
				specialPopulate(localCommand);
			}
		}
	};
}
 
开发者ID:adketuri,项目名称:umbracraft,代码行数:18,代码来源:ScriptCommandWidget.java


示例18: 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 String passwordCharacter = parser.parseString(rawAttributeData, actor);
    if (Strings.isEmpty(passwordCharacter)) {
        parser.throwError("Password character setting cannot be empty. String with length of 1 is required.");
    } else if (passwordCharacter.length() != 1) {
        parser.throwErrorIfStrict("String with length of 1 is required for password character setting.");
    }
    // At this point, string must have at least 1 character.
    actor.setPasswordCharacter(passwordCharacter.charAt(0));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:13,代码来源:PasswordCharacterLmlAttribute.java


示例19: 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) {
    LmlUtilities.getLmlUserObject(actor).addOnCloseAction(new ActorConsumer<Object, Object>() {
        @Override
        public Void consume(final Object widget) {
            actor.setCursorPosition(parser.parseInt(rawAttributeData, actor));
            return null;
        }
    });
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:12,代码来源:CursorLmlAttribute.java


示例20: 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) {
    if (parser.parseBoolean(rawAttributeData, actor)) {
        LmlUtilities.getLmlUserObject(actor).addOnCloseAction(new ActorConsumer<Object, Object>() {
            @Override
            public Object consume(final Object widget) {
                actor.selectAll();
                return null;
            }
        });
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:14,代码来源:SelectAllLmlAttribute.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PersistentSet类代码示例发布时间:2022-05-22
下一篇:
Java LinearDRPCTopologyBuilder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap