本文整理汇总了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);
}
示例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);
}
示例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;
}
}
示例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;
}