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

Java TextFieldStyle类代码示例

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

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



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

示例1: createButton

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
private void createButton() {

		Skin skin = getGameObject().getComponentInParent(JCanvas.class).getSkin();
//		TextFieldStyle style = new TextFieldStyle(skin.get("default", TextFieldStyle.class));
		
		int realSize = (int) (((getTransform().getScale().x + getTransform().getScale().y) / 2) * fontSize);
		SmartFontGenerator fontGen = new SmartFontGenerator();
		FileHandle exoFile = Gdx.files.internal(fontResource.getResourcePath());
		BitmapFont fontBitmap = fontGen.createFont(exoFile, fontResource.getResourcePath() + realSize, realSize);
	
		TextFieldStyle styleDefault = skin.get("default", TextFieldStyle.class);
		TextFieldStyle style = new TextFieldStyle(fontBitmap, fontColor, styleDefault.cursor, styleDefault.selection, styleDefault.background);
		
		style.fontColor = fontColor;
		textField = new TextField(text, style);
		textField.addListener(new ChangeListener() {

			@Override
			public void changed(ChangeEvent event, Actor actor) {
				text = textField.getText();				
			}

		});

	}
 
开发者ID:Radomiej,项目名称:JavityEngine,代码行数:26,代码来源:JTextField.java


示例2: getComponent

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
@Override
public Component getComponent(Label component) {
	Skin skin = gameAssets.getSkin();
	EditableLabelComponent button = gameLoop
			.createComponent(EditableLabelComponent.class);
	button.initialize(controller, component);
	button.setVariablesManager(variablesManager);

	TextFieldStyle style = skin.get(component.getStyle(),
			TextFieldStyle.class);
	TextFieldStyle styleCopy = new TextFieldStyle(style);
	button.setStyle(styleCopy);
	button.setText(gameAssets.getI18N().m(component.getText()));

	I18nTextComponent textComponent = gameLoop
			.createComponent(I18nTextComponent.class);
	textComponent.setI18nKey(component.getText());
	textComponent.setTextSetter(button);
	return new MultiComponent(button, textComponent);
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:21,代码来源:EditableLabelProccesor.java


示例3: ConsoleDisplay

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
protected ConsoleDisplay (Skin skin) {
	this.setFillParent(false);
	this.skin = skin;

	if (skin.has("console-font", BitmapFont.class))
		fontName = "console-font";
	else
		fontName = "default-font";

	TextFieldStyle tfs = skin.get(TextFieldStyle.class);
	tfs.font = skin.getFont(fontName);

	labels = new Array<Label>();

	logEntries = new Table(skin);

	input = new TextField("", tfs);
	input.setTextFieldListener(new FieldListener());

	scroll = new ScrollPane(logEntries, skin);
	scroll.setFadeScrollBars(false);
	scroll.setScrollbarsOnTop(false);
	scroll.setOverscroll(false, false);

	this.add(scroll).expand().fill().pad(4).row();
	this.add(input).expandX().fillX().pad(4);
	this.addListener(new KeyListener(input));
}
 
开发者ID:StrongJoshua,项目名称:libgdx-inGameConsole,代码行数:29,代码来源:GUIConsole.java


示例4: addTextField

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
public void addTextField(String label, Object value, TextFieldListener lis) {
  Label l = new Label(label, skin.get(LabelStyle.class));
  table.add(l).minHeight(l.getMinHeight()).prefHeight(l.getPrefHeight());

  TextField t = new TextField(String.valueOf(value), skin.get(TextFieldStyle.class));
  t.setTextFieldListener(lis);
  t.setDisabled(false);
  t.setMaxLength(6);
  if (value instanceof Number)
    t.setTextFieldFilter((textField, c) -> Character.isDigit(c));
  table.add(t).right().padLeft(1f);

  table.row();
}
 
开发者ID:guillaume-alvarez,项目名称:ShapeOfThingsThatWere,代码行数:15,代码来源:FramedMenu.java


示例5: onFinishLoading

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
@Override
public void onFinishLoading() {
    Skin skin = getSkin(Assets.Skin.UI_SKIN);
    BitmapFont menuFont = getFont(game.deviceSettings.menuFont);
    BitmapFont screenTitle = getFont(game.deviceSettings.screenTitleFont);
    BitmapFont hudFont = getFont(game.deviceSettings.hudFont);
    BitmapFont rulesFont = getFont(game.deviceSettings.rulesFont);

    skin.get(Assets.Skin.SKIN_STYLE_MENU, TextButtonStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, TextButtonStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, TextButtonStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, ImageTextButtonStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, ImageTextButtonStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, SelectBoxStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_MENU, SelectBoxStyle.class).listStyle.font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, SelectBoxStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, SelectBoxStyle.class).listStyle.font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, WindowStyle.class).titleFont = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, LabelStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_SCREEN_TITLE, LabelStyle.class).font = screenTitle;

    skin.get(Assets.Skin.SKIN_STYLE_GAME, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_PLAYER_TAG, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_RULES, LabelStyle.class).font = rulesFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, TextFieldStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, TextFieldStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, CheckBoxStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, CheckBoxStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, ListStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, ListStyle.class).font = hudFont;
}
 
开发者ID:apotapov,项目名称:tafl,代码行数:40,代码来源:TaflGraphicsService.java


示例6: ChatTextField

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
public ChatTextField (String text, TextFieldStyle style) {
	setStyle(style);
	this.clipboard = Gdx.app.getClipboard();
	setText(text);
	setWidth(getPrefWidth());
	setHeight(getPrefHeight());
	initialize();
}
 
开发者ID:Leejjon,项目名称:libgdx-chat-example,代码行数:9,代码来源:ChatTextField.java


示例7: LoadContent

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
@SuppressWarnings("deprecation")
   public static void LoadContent() {
			
	grass = new Texture(Gdx.files.internal("grass.png"));
	water = new Texture(Gdx.files.internal("Water.png"));
	stone = new Texture(Gdx.files.internal("Stone.png"));
	lava = new Texture(Gdx.files.internal("Lava.png"));
	swamp = new Texture(Gdx.files.internal("Swamp.png"));
	brick = new Texture(Gdx.files.internal("bricks.png"));
	notpassable = new Texture(Gdx.files.internal("notpassable.png"));
	passable = new Texture(Gdx.files.internal("passable.png"));
	texWidth = grass.getWidth();
	texHeight = grass.getWidth();
	FileHandle fontFile = Gdx.files.internal("./bin/data/fonts/tahoma.ttf");
       FreeTypeFontGenerator generator = new FreeTypeFontGenerator(
               fontFile);
       font = generator.generateFont(fontSize, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789����������������������������������������������������������������:][_!$%#@|\\/?-+=()*&.;,{}\"'<>",
               false);
       
       screenWidth = Gdx.graphics.getWidth();
       screenHeight = Gdx.graphics.getHeight();
       
       Vars.balancedScreenHeight = 1024 / screenHeight;
       Vars.balancedScreenWidth = 1280 / screenWidth;
       
	txtBtnStyle = new TextButtonStyle();
	txtBtnStyle.font = getFont();

	labelStyle = new LabelStyle();
	labelStyle.font = getFont();

	txtFieldStyle = new TextFieldStyle();
	txtFieldStyle.font = getFont();
	txtFieldStyle.fontColor = new Color(1, 1, 1, 1);
	
}
 
开发者ID:MosaicOwl,项目名称:the-erder,代码行数:37,代码来源:GameManager.java


示例8: setStyle

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
public void setStyle(TextFieldStyle style) {
	if (label == null) {
		label = new EditableLabel(text.getText(), style, DEFAULT_TAP_COUNT);
		label.initLabelListener(controller, text);
	} else {
		label.setStyle(style);
	}
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:9,代码来源:EditableLabelComponent.java


示例9: setupSkin

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
/**
 * Setups a simple skin without any ressource
 *
 * @return A simple Skin
 */
private Skin setupSkin() {
    Skin skin = new Skin();

    Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    skin.add("white", new Texture(pixmap));

    skin.add("default", new BitmapFont());

    TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.down = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);
    textButtonStyle.font = skin.getFont("default");
    skin.add("default", textButtonStyle);

    LabelStyle labelStyle = new LabelStyle();
    labelStyle.font = skin.getFont("default");
    labelStyle.fontColor = Color.BLACK;
    skin.add("default", labelStyle);

    LabelStyle redLabelStyle = new LabelStyle();
    redLabelStyle.font = skin.getFont("default");
    redLabelStyle.fontColor = Color.RED;
    skin.add("red", redLabelStyle);

    TextFieldStyle textFieldStyle = new TextFieldStyle();
    textFieldStyle.font = skin.getFont("default");
    textFieldStyle.fontColor = Color.BLACK;
    textFieldStyle.background = skin.newDrawable("white", Color.LIGHT_GRAY);
    skin.add("default", textFieldStyle);
    return skin;
}
 
开发者ID:highstreeto,项目名称:XMLLayoutParser,代码行数:40,代码来源:ExampleGame.java


示例10: resetProperties

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
public void resetProperties() {
    properties.clear();
    
    if (clazz.equals(Button.class)) {
        newStyleProperties(ButtonStyle.class);
    } else if (clazz.equals(CheckBox.class)) {
        newStyleProperties(CheckBoxStyle.class);
        properties.get("checkboxOn").optional = false;
        properties.get("checkboxOff").optional = false;
        properties.get("font").optional = false;
    } else if (clazz.equals(ImageButton.class)) {
        newStyleProperties(ImageButtonStyle.class);
    } else if (clazz.equals(ImageTextButton.class)) {
        newStyleProperties(ImageTextButtonStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(Label.class)) {
        newStyleProperties(LabelStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(List.class)) {
        newStyleProperties(ListStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColorSelected").optional = false;
        properties.get("fontColorUnselected").optional = false;
        properties.get("selection").optional = false;
    } else if (clazz.equals(ProgressBar.class)) {
        newStyleProperties(ProgressBarStyle.class);
        
        //Though specified as optional in the doc, there are bugs without "background" being mandatory
        properties.get("background").optional = false;
    } else if (clazz.equals(ScrollPane.class)) {
        newStyleProperties(ScrollPaneStyle.class);
    } else if (clazz.equals(SelectBox.class)) {
        newStyleProperties(SelectBoxStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColor").optional = false;
        properties.get("scrollStyle").optional = false;
        properties.get("scrollStyle").value = "default";
        properties.get("listStyle").optional = false;
        properties.get("listStyle").value = "default";
    } else if (clazz.equals(Slider.class)) {
        newStyleProperties(SliderStyle.class);
        
        //Though specified as optional in the doc, there are bugs without "background" being mandatory
        properties.get("background").optional = false;
    } else if (clazz.equals(SplitPane.class)) {
        newStyleProperties(SplitPaneStyle.class);
        properties.get("handle").optional = false;
    } else if (clazz.equals(TextButton.class)) {
        newStyleProperties(TextButtonStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(TextField.class)) {
        newStyleProperties(TextFieldStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColor").optional = false;
    } else if (clazz.equals(TextTooltip.class)) {
        newStyleProperties(TextTooltipStyle.class);
        properties.get("label").optional = false;
        properties.get("label").value = "default";
    } else if (clazz.equals(Touchpad.class)) {
        newStyleProperties(TouchpadStyle.class);
    } else if (clazz.equals(Tree.class)) {
        newStyleProperties(TreeStyle.class);
        properties.get("plus").optional = false;
        properties.get("minus").optional = false;
    } else if (clazz.equals(Window.class)) {
        newStyleProperties(WindowStyle.class);
        properties.get("titleFont").optional = false;
    }
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:70,代码来源:StyleData.java


示例11: SpinnerStyle

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
public SpinnerStyle(ButtonStyle buttonMinusStyle, ButtonStyle buttonPlusStyle, TextFieldStyle textFieldStyle) {
    this.buttonMinusStyle = buttonMinusStyle;
    this.buttonPlusStyle = buttonPlusStyle;
    this.textFieldStyle = textFieldStyle;
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:6,代码来源:Spinner.java


示例12: init

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
@Override
public void init() {
    stage = new Stage();

    // TODO memory manage

    background = new Texture(Gdx.files.internal("textures/block/obsidian.png"));
    background.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);

    errorLabel = new Label(null, new LabelStyle(new BitmapFont(), Color.RED));

    TextFieldStyle fieldStyle = new TextFieldStyle();
    fieldStyle.font = new BitmapFont();
    fieldStyle.fontColor = Color.WHITE;
    TextField ipField = new TextField("IP:Port", fieldStyle);

    ImageTextButtonStyle btnStyle = RadixClient.getInstance().getSceneTheme().getButtonStyle();

    TextButton connectButton = new TextButton("Connect", btnStyle);
    connectButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            String[] ipPort = ipField.getText().split(":");

            if(ipPort.length != 2) {
                invalidIpSyntax();
                return;
            }

            try {
                RadixClient.getInstance().enterRemoteWorld(ipPort[0], Short.parseShort(ipPort[1]));
            } catch (NumberFormatException ex) {
                invalidPort();
            }
        }
    });

    Table table = new Table();
    table.setFillParent(true);
    table.add(ipField);
    table.row();
    table.add(errorLabel);
    table.row();
    table.add(connectButton);
    stage.addActor(table);
}
 
开发者ID:mstojcevich,项目名称:Radix,代码行数:47,代码来源:ServerConnectGUI.java


示例13: NewSave

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
public NewSave(OdysseeDesMaths game) {
    this.game = game;

    viewport = new StretchViewport(WIDTH, HEIGHT);
    stage = new Stage(viewport);
    Gdx.input.setInputProcessor(stage);

    table = new Table();
    table.setFillParent(true);
    stage.addActor(table);

    skin = new Skin();
    skin.addRegions(Assets.getManager().get(Assets.UI_MAIN, TextureAtlas.class));
    skin.addRegions(Assets.getManager().get(Assets.UI_ORANGE, TextureAtlas.class));
    skin.add("background", Assets.getManager().get(Assets.MAIN_MENU_BACKGROUND, Texture.class));
    skin.add("title", new LabelStyle(TITLE, null));
    skin.add("text", new LabelStyle(TEXT, null));

    TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.font = TEXT;
    textButtonStyle.up = skin.getDrawable("button");
    textButtonStyle.down = skin.getDrawable("button_pressed");
    skin.add("textButton", textButtonStyle);

    TextFieldStyle textFieldStyle = new TextFieldStyle();
    textFieldStyle.font = TEXT;
    textFieldStyle.fontColor = Color.BLACK;
    textFieldStyle.background = skin.getDrawable("field");
    textFieldStyle.focusedBackground = skin.getDrawable("field_focused");
    skin.add("textField", textFieldStyle);

    ButtonStyle returnButtonStyle = new ButtonStyle();
    returnButtonStyle.up = skin.getDrawable("return");
    skin.add("returnButton", returnButtonStyle);

    gameTitle = new Label("L'Odyssée des Maths", skin, "title");
    saveNameLabel = new Label("Nom:", skin, "text");
    saveNameField = new TextField("", skin, "textField");
    saveNameField.setMaxLength(7);
    submit = new TextButton("C'est parti !", skin, "textButton");
    audioButtons = new AudioButtons();
    returnButton = new Button(skin, "returnButton");

    table.setBackground(skin.getDrawable("background"));
    table.padTop(HEIGHT / 13);
    table.add(gameTitle).top().colspan(2).padBottom(HEIGHT / 9).expandX();
    table.row().padBottom(HEIGHT / 10);
    table.add(saveNameLabel).right().padRight(10);
    table.add(saveNameField).size(200, 48).left();
    table.row();
    table.add(submit).size(350, 64).top().colspan(2).expandY();
    table.row();
    table.add(audioButtons).left();
    table.add(returnButton).right();

    NewSaveListener listener = new NewSaveListener();
    submit.addListener(listener);
    returnButton.addListener(listener);

    noNameSubmitAction = new ColorAction();
    noNameSubmitAction.setEndColor(Color.WHITE);
    noNameSubmitAction.setDuration(0.5f);
}
 
开发者ID:naomiHauret,项目名称:OdysseeDesMaths,代码行数:64,代码来源:NewSave.java


示例14: setStyle

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
public void setStyle (TextFieldStyle style) {
	if (style == null) throw new IllegalArgumentException("style cannot be null.");
	this.style = style;
	invalidateHierarchy();
}
 
开发者ID:Leejjon,项目名称:libgdx-chat-example,代码行数:6,代码来源:ChatTextField.java


示例15: getStyle

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
/** Returns the text field's style. Modifying the returned style may not have an effect until {@link #setStyle(TextFieldStyle)}
 * is called. */
public TextFieldStyle getStyle () {
	return style;
}
 
开发者ID:Leejjon,项目名称:libgdx-chat-example,代码行数:6,代码来源:ChatTextField.java


示例16: getTextFieldStyle

import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle; //导入依赖的package包/类
public TextFieldStyle getTextFieldStyle() {
	return skin.get(TextFieldStyle.class);
}
 
开发者ID:suluke,项目名称:gdx.automation,代码行数:4,代码来源:StyleHelper.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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