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


Java TextField.setWidth方法代码示例

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


在下文中一共展示了TextField.setWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SettingScreenOld

import com.badlogic.gdx.scenes.scene2d.ui.TextField; //导入方法依赖的package包/类
public SettingScreenOld(Viewport viewport, Skin skin) {
    float screenWidth = Gdx.graphics.getWidth();
    float screenHeight = Gdx.graphics.getHeight();
    stage = new Stage(viewport);

    Label label = new Label("Player 1", skin);
    label.setPosition(screenWidth / 2, screenHeight - 10, Align.top);
    stage.addActor(label);

    label = new Label("Forward", skin);
    label.setPosition(10, screenHeight - 60);
    stage.addActor(label);

    TextField field = new TextField("", skin);
    field.setPosition(50, screenHeight - 20);
    field.setWidth(100);
    field.setHeight(50);
    stage.addActor(field);
}
 
开发者ID:KillianMeersman,项目名称:Geometry-wars,代码行数:20,代码来源:SettingScreenOld.java

示例2: create

import com.badlogic.gdx.scenes.scene2d.ui.TextField; //导入方法依赖的package包/类
@Override
public void create () {
	stage = new Stage();
	Gdx.input.setInputProcessor(stage);
	skin = new Skin(Gdx.files.internal("data/uiskin.json"));
	TextArea textArea = new TextArea(
		"Text Area\nEssentially, a text field\nwith\nmultiple\nlines.\n"
			+ "It can even handle very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong lines.",
		skin);
	textArea.setX(10);
	textArea.setY(10);
	textArea.setWidth(200);
	textArea.setHeight(200);

	TextField textField = new TextField("Text field", skin);
	textField.setX(10);
	textField.setY(220);
	textField.setWidth(200);
	textField.setHeight(30);
	stage.addActor(textArea);
	stage.addActor(textField);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:23,代码来源:TextAreaTest.java

示例3: initialize

import com.badlogic.gdx.scenes.scene2d.ui.TextField; //导入方法依赖的package包/类
private boolean initialize() {
  if (SharedAssetManager.isLoaded(Assets.TEX_PANEL_TRANSPARENT_9patch)
      && SharedAssetManager.isLoaded(Assets.FNT_MONO) && Styles.TXT_COMMANDLINE != null
      && Styles.TXT_COMMANDLINE.font != null) {
    setBackground(new NinePatchDrawable(GraphicsFactory.createNinePatch(Assets.TEX_PANEL_TRANSPARENT_9patch,
        Sizes.panelTransparentRadius())));
    textField = new TextField("", Styles.TXT_COMMANDLINE);
    textField.setWidth(getWidth());
    LabelStyle consoleStyle = new LabelStyle();
    consoleStyle.font = SharedAssetManager.get(Assets.FNT_MONO, BitmapFont.class);
    consoleStyle.fontColor = Color.GRAY;
    add(new Label("$ ", consoleStyle));
    add(textField).width(getWidth());
    setY(Sizes.worldHeight() - textField.getHeight());
    setHeight(textField.getHeight());
    return true;
  } else {
    return false;
  }
}
 
开发者ID:bitbrain,项目名称:craft,代码行数:21,代码来源:CommandLineInterface.java

示例4: RoomChatPanel

import com.badlogic.gdx.scenes.scene2d.ui.TextField; //导入方法依赖的package包/类
public RoomChatPanel (float w, float h) {
	super();
	
	content = new StringBuilder();
	chatprint= new Label(content,Resources._skin);
	
	inputfield = new TextField("",Resources._skin);
	inputfield.setWidth(w);
	inputfield.setMaxLength(max_char_per_mess);
	inputfield.setMessageText("Enter to send ...");
	inputfield.addListener(new InputListener() {
		RoomChat__ chat = new RoomChat__();
		public boolean keyTyped(InputEvent event, char character) {
			if ( character == 13) {
				chat.content = inputfield.getText().getBytes();
				Resources._nclient.sendRoomChat(chat);
				inputfield.setText("");
			}
			return false;
		};
	} );
	
	scrpane = new ScrollPane(chatprint, Resources._skin);
	scrpane.setSize(w,h-inputfield.getHeight()-1);
	scrpane.setFadeScrollBars(false);
	scrpane.setPosition(0,inputfield.getHeight()+1);

	addActor(scrpane);
	addActor(inputfield);
	
	
	this.h = h;
	this.w = w;
}
 
开发者ID:s76,项目名称:zesp2013,代码行数:35,代码来源:RoomChatPanel.java


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