當前位置: 首頁>>代碼示例>>Java>>正文


Java TextButton.setWidth方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.TextButton.setWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java TextButton.setWidth方法的具體用法?Java TextButton.setWidth怎麽用?Java TextButton.setWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.scenes.scene2d.ui.TextButton的用法示例。


在下文中一共展示了TextButton.setWidth方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createToolTip

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
private void createToolTip()
{
	Skin skin = new Skin();
	Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
	pixmap.setColor(Color.WHITE);
	pixmap.fill();
	skin.add("white", new Texture(pixmap));
	skin.add("default", new BitmapFont());

	TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
	textButtonStyle.font = skin.getFont("default");
	skin.add("default", textButtonStyle);

	labelToolTip = new TextButton("TEST", skin);
	labelToolTip.setX(5);
	labelToolTip.setY(5);
	labelToolTip.setWidth(125);
	labelToolTip.setVisible(false);
	labelToolTip.getLabel().setWrap(true);
	labelToolTip.setHeight(labelToolTip.getLabel().getHeight());
	group.addActor(labelToolTip);
}
 
開發者ID:MartensCedric,項目名稱:LD38-Compo,代碼行數:24,代碼來源:LudumDare38.java

示例2: createResetButton

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
private void createResetButton()
{
	Skin skin = new Skin();
	Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
	pixmap.setColor(Color.WHITE);
	pixmap.fill();
	skin.add("white", new Texture(pixmap));
	skin.add("default", new BitmapFont());

	TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
	textButtonStyle.font = skin.getFont("default");
	skin.add("default", textButtonStyle);

	btnReset = new TextButton("RESET", skin);
	btnReset.setX(5);
	btnReset.setY(Gdx.graphics.getHeight() - 25);
	btnReset.setWidth(60);
	btnReset.setVisible(true);
	group.addActor(btnReset);
}
 
開發者ID:MartensCedric,項目名稱:LD38-Compo,代碼行數:22,代碼來源:LudumDare38.java

示例3: createUndoButton

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
private void createUndoButton()
{
	Skin skin = new Skin();
	Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
	pixmap.setColor(Color.WHITE);
	pixmap.fill();
	skin.add("white", new Texture(pixmap));
	skin.add("default", new BitmapFont());

	TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
	textButtonStyle.font = skin.getFont("default");
	skin.add("default", textButtonStyle);

	btnUndo = new TextButton("UNDO", skin);
	btnUndo.setX(70);
	btnUndo.setY(Gdx.graphics.getHeight() - 25);
	btnUndo.setWidth(60);
	btnUndo.setVisible(true);
	group.addActor(btnUndo);
}
 
開發者ID:MartensCedric,項目名稱:LD38-Compo,代碼行數:22,代碼來源:LudumDare38.java

示例4: createComponents

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的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);
}
 
開發者ID:EtherWorks,項目名稱:arcadelegends-gg,代碼行數:23,代碼來源:GameOverScreen.java

示例5: setupUIManager

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
@Override
   public void setupUIManager(String skinPath) {

// create new uiManager and skin
super.setupUIManager(skinPath);
// after we have uiManager, skin, uiCamera...
// Add some stuffs to uiManager
btnStartWave = new TextButton("Unleash Monster!", skin);
btnStartWave.setWidth(150);
btnStartWave.setPosition(
	Gdx.graphics.getWidth() - btnStartWave.getWidth(), 0);
btnStartWave.addListener(new ChangeListener() {

    @Override
    public void changed(ChangeEvent event, Actor actor) {

	level.setEnabled(!level.isEnabled());
	player.setEnabled(level.isEnabled());
	if (level.isEnabled()) {
	    btnStartWave.setText("Pause Game");
	} else {
	    btnStartWave.setText("Unleash Monsters!");
	}
    }
});

uiManager.addActor(btnStartWave);

lblPlayerGold = new Label("Gold: ", skin);
lblPlayerGold.setColor(Color.CYAN);
lblPlayerGold.setPosition(0,
	Gdx.graphics.getHeight() - lblPlayerGold.getHeight());
uiManager.addActor(lblPlayerGold);

lblPlayerLives = new Label("Gold: ", skin);
lblPlayerLives.setColor(Color.CYAN);
lblPlayerLives.setPosition(
	Gdx.graphics.getWidth() - btnStartWave.getWidth(),
	Gdx.graphics.getHeight() - lblPlayerLives.getHeight());
uiManager.addActor(lblPlayerLives);

gameDialog = new GameDialog(skin){
    
    @Override
    public void restartGame() {
	initialize();
    }
};
gameDialog.setVisible(false);
uiManager.addActor(gameDialog);
   }
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:52,代碼來源:TowerDefenseScene.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.TextButton.setWidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。