本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Label.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setWidth方法的具体用法?Java Label.setWidth怎么用?Java Label.setWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.Label
的用法示例。
在下文中一共展示了Label.setWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createComponents
import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
private void createComponents()
{
btBackToMainMenu = new TextButton("Back to Main Menu", skin);
btBackToMainMenu.center();
btBackToMainMenu.setWidth(600);
btBackToMainMenu.setHeight(80);
btBackToMainMenu.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
AL.getGame().setScreen(AL.getScreenManager().get(MainMenuScreen.class));
}
});
btBackToMainMenu.setPosition(1920 / 2 - 300, 1080 / 2 + 40);
stage.addActor(btBackToMainMenu);
endgameLabel = new Label(endgameText, skin);
endgameLabel.setWidth(600);
endgameLabel.setHeight(80);
endgameLabel.setAlignment(Align.center);
endgameLabel.setPosition(1920 / 2 - 300, 1080 / 1.5f);
stage.addActor(endgameLabel);
}
示例2: createErrorMessagePanel
import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
private void createErrorMessagePanel(){
_errorMessageLbl = new Label("", Assets._skin);
_errorMessageLbl.setColor(1f , 0.15f , 0.15f , 1f);
_errorMessageLbl.setFontScale(2f);
_errorMessageLbl.setAlignment(Align.center);
_errorMessageLbl.setWidth(Gdx.graphics.getWidth());
_errorMessageLbl.setAlignment(Align.center);
_errorMessageLbl.setPosition(0 , 200);
this.addActor(_errorMessageLbl);
}
示例3: DrawOneAttachers
import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
private Group DrawOneAttachers(String typeFrame, String name, Color type, String photo, float energy,float energymax) {
Group gr = new Group();
Texture txt = managerAssets.getAssetsCombat().getTexture(typeFrame);
Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
final Image frame = new Image(new TextureRegion(txt));
frame.setName("frame");
frame.setSize(crop.x * 0.18f, crop.y * 0.2f);
frame.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
gr.addActor(frame);
if(InformationProfile.getInstance().getDateUserGame().getFaction() != InformationEnklave.getInstance().getFaction())
txt = managerAssets.getAssetsCombat().getTexture(NameFiles.targetRecharge);
else
txt = managerAssets.getAssetsCombat().getTexture(NameFiles.target);
crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
Image frameselect = new Image(new TextureRegion(txt));
frameselect.setSize(crop.x * 0.18f, crop.y * 0.2f);
frameselect.setName("frameselect");
frameselect.toFront();
frameselect.setPosition(WIDTH - frame.getWidth() * 1.13f, HEIGHT / 2.3f);
frameselect.setVisible(false);
gr.addActor(frameselect);
Label labelName = new Label(name.substring(0,name.length()>9 ? 9 : name.length()), new Label.LabelStyle(bt, type));
labelName.setAlignment(Align.center);
labelName.setWidth(crop.x*0.18f);
labelName.setPosition(frame.getX(), frame.getY() + frame.getHeight() * 0.25f);
gr.addActor(labelName);
txt = managerAssets.getAssetsCombat().getTexture(photo);
crop = Scaling.fit.apply(txt.getWidth(), txt.getHeight(), WIDTH, HEIGHT);
Image profile = new Image(new TextureRegion(txt));
profile.setColor(type);
profile.setSize(crop.x * 0.07f, crop.y * 0.07f);
profile.setPosition(frame.getRight() - frame.getWidth() / 2 - profile.getWidth() / 2, frame.getY() + frame.getHeight() * 0.42f);
gr.addActor(profile);
Skin skin = new Skin();
skin.add("white", new TextureRegion(managerAssets.getAssetsCombat().getTexture(NameFiles.barLifeWhite), 0, 0, (int) (WIDTH * 0.014), (int) (WIDTH * 0.014)));
ProgressBar.ProgressBarStyle barStyle = new ProgressBar.ProgressBarStyle(skin.newDrawable("white", Color.WHITE), skin.newDrawable("white", type));
barStyle.knobBefore = barStyle.knob;
ProgressBar bar = new ProgressBar(0,energymax, 1, false, barStyle);
bar.setSize(WIDTH * 0.14f,HEIGHT * 0.012f);
bar.setPosition(frame.getX() + frame.getWidth() * 0.07f, frame.getY() + frame.getHeight() * 0.07f);
bar.setValue(energy);
gr.addActor(bar);
return gr;
}
示例4: selectLevel
import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public void selectLevel(int levelID)
{
try{
levelSelect = levelID;
Map map = loadDisplayLevel();
TextureRegionDrawable textureBad = new TextureRegionDrawable(
new TextureRegion(hexpert.assetManager.get(TextureData.TEXTURE_BAD, Texture.class)));
TextureRegionDrawable textureCorrect = new TextureRegionDrawable(
new TextureRegion(hexpert.assetManager.get(TextureData.TEXTURE_CORRECT, Texture.class)));
if(result.getScore() > 0)
lblHighScore.setText(hexpert.i18NBundle.format("best", result.getScore()));
else lblHighScore.setText("");
float y = 750;
switch (result.getObjectivePassed().length)
{
case 1 :
y = 1000;
break;
case 2 :
y = 930;
break;
case 3 :
y = 860;
break;
}
objectiveTable.setY(y);
objectiveTable.clearChildren();
for(int i = 0; i < map.getObjectives().length; i++)
{
ImageButton imgBad = new ImageButton(textureBad);
ImageButton imgCorrect = new ImageButton(textureCorrect);
imgBad.getImageCell().expand().fill();
imgCorrect.getImageCell().expand().fill();
objectiveTable.add(result.getObjectivePassed()[i] ? imgCorrect : imgBad).width(100).height(100);
Label lblDesc = new Label(map.getObjectives()[i].toString(hexpert.i18NBundle), hexpert.getSkin());
lblDesc.setWidth(200);
lblDesc.setWrap(true);
objectiveTable.add(lblDesc);
objectiveTable.row();
}
}catch (Exception e)
{
e.printStackTrace();
}
}